diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index a1750752f..74d6d4534 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -394,12 +394,6 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port) } setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(void *)&opt,sizeof(opt)); #ifdef __APPLE__ - timeout.tv_sec = 0; - timeout.tv_usec = 30000; - setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(void *)&timeout,sizeof(timeout)); - timeout.tv_sec = 0; - timeout.tv_usec = 10000; - setsockopt(sock,SOL_SOCKET,SO_SNDTIMEO,(void *)&timeout,sizeof(timeout)); setsockopt(sock,SOL_SOCKET,SO_NOSIGPIPE,&opt,sizeof(opt)); #endif #endif @@ -442,6 +436,12 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port) return(-1); } } + timeout.tv_sec = 0; + timeout.tv_usec = 30000; + setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(void *)&timeout,sizeof(timeout)); + timeout.tv_sec = 0; + timeout.tv_usec = 10000; + setsockopt(sock,SOL_SOCKET,SO_SNDTIMEO,(void *)&timeout,sizeof(timeout)); if ( listen(sock,64) != 0 ) { printf("listen(%s) port.%d failed: %s sock.%d. errno.%d\n",hostname,port,strerror(errno),sock,errno);