From e526a1c741be34e82942dc9bd5d0c77d7ef04509 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 17 Sep 2016 13:00:40 -0300 Subject: [PATCH] timeout moved --- iguana/iguana_peers.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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);