"step" could be zero, in which case the loop would never end.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19809 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-01-15 12:53:11 +00:00
parent 6f19c1db2d
commit 9aed1afa6a

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -272,7 +272,7 @@ EndpointManager::BindToEphemeral(TCPEndpoint *endpoint, sockaddr *address)
for (int32 i = 1; i < 5; i++) {
// try to retrieve a more or less random port
uint32 counter = kFirstEphemeralPort;
uint32 step = i == 4 ? 1 : system_time() & 0x1f;
uint32 step = i == 4 ? 1 : (system_time() & 0x1f) + 1;
while (counter < max) {
uint16 port = counter & 0xffff;