Attempt at fixing bind() bug
This will prevent the bind() wrapper to loop forever in some cases. I could nor reproduc the issue, but this removes the only infinite loop I could find. Signed-off-by: Michel Pollet <buserror@gmail.com>
This commit is contained in:

committed by
Patrick J Cherry

parent
e3360a3a1b
commit
76e0476113
@@ -100,7 +100,7 @@ int sock_try_bind( int fd, const struct sockaddr* sa )
|
||||
{
|
||||
int bind_result;
|
||||
char s_address[256];
|
||||
int retry = 1;
|
||||
int retry = 10;
|
||||
|
||||
sockaddr_address_string( sa, &s_address[0], 256 );
|
||||
|
||||
@@ -126,8 +126,11 @@ int sock_try_bind( int fd, const struct sockaddr* sa )
|
||||
* will cope with it.
|
||||
*/
|
||||
case EADDRNOTAVAIL:
|
||||
retry--;
|
||||
if (retry) {
|
||||
debug( "retrying" );
|
||||
sleep( 1 );
|
||||
}
|
||||
continue;
|
||||
case EADDRINUSE:
|
||||
warn( "%s in use, giving up.", s_address );
|
||||
|
Reference in New Issue
Block a user