Merge branch '12-fix-bind' into 'master'
Attempt at fixing bind() bug This will prevent the bind() wrapper to loop forever in some cases. I could nor reproduce the issue, but this removes the only infinite loop I could find. Closes #12 See merge request !3
This commit is contained in:
@@ -100,7 +100,7 @@ int sock_try_bind( int fd, const struct sockaddr* sa )
|
|||||||
{
|
{
|
||||||
int bind_result;
|
int bind_result;
|
||||||
char s_address[256];
|
char s_address[256];
|
||||||
int retry = 1;
|
int retry = 10;
|
||||||
|
|
||||||
sockaddr_address_string( sa, &s_address[0], 256 );
|
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.
|
* will cope with it.
|
||||||
*/
|
*/
|
||||||
case EADDRNOTAVAIL:
|
case EADDRNOTAVAIL:
|
||||||
debug( "retrying" );
|
retry--;
|
||||||
sleep( 1 );
|
if (retry) {
|
||||||
|
debug( "retrying" );
|
||||||
|
sleep( 1 );
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
case EADDRINUSE:
|
case EADDRINUSE:
|
||||||
warn( "%s in use, giving up.", s_address );
|
warn( "%s in use, giving up.", s_address );
|
||||||
|
Reference in New Issue
Block a user