Browse Source

timeout moved

dPoW2
jl777 8 years ago
parent
commit
e526a1c741
  1. 12
      iguana/iguana_peers.c

12
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)); setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(void *)&opt,sizeof(opt));
#ifdef __APPLE__ #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)); setsockopt(sock,SOL_SOCKET,SO_NOSIGPIPE,&opt,sizeof(opt));
#endif #endif
#endif #endif
@ -442,6 +436,12 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port)
return(-1); 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 ) if ( listen(sock,64) != 0 )
{ {
printf("listen(%s) port.%d failed: %s sock.%d. errno.%d\n",hostname,port,strerror(errno),sock,errno); printf("listen(%s) port.%d failed: %s sock.%d. errno.%d\n",hostname,port,strerror(errno),sock,errno);

Loading…
Cancel
Save