Browse Source

Test

etomic
jl777 7 years ago
parent
commit
b26e164e33
  1. 6
      iguana/exchanges/LP_socket.c

6
iguana/exchanges/LP_socket.c

@ -126,10 +126,12 @@ int32_t LP_socket(int32_t bindflag,char *hostname,uint16_t port)
#endif #endif
if ( bindflag == 0 ) if ( bindflag == 0 )
{ {
timeout.tv_sec = 10; timeout.tv_sec = 2;
timeout.tv_usec = 0; timeout.tv_usec = 0;
setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(void *)&timeout,sizeof(timeout)); setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(void *)&timeout,sizeof(timeout));
printf("call connect\n");
result = connect(sock,(struct sockaddr *)&saddr,addrlen); result = connect(sock,(struct sockaddr *)&saddr,addrlen);
printf("called connect result.%d\n",result);
if ( result != 0 ) if ( result != 0 )
{ {
if ( errno != ECONNRESET && errno != ENOTCONN && errno != ECONNREFUSED && errno != ETIMEDOUT && errno != EHOSTUNREACH ) if ( errno != ECONNRESET && errno != ENOTCONN && errno != ECONNREFUSED && errno != ETIMEDOUT && errno != EHOSTUNREACH )
@ -140,7 +142,7 @@ int32_t LP_socket(int32_t bindflag,char *hostname,uint16_t port)
closesocket(sock); closesocket(sock);
return(-1); return(-1);
} }
timeout.tv_sec = 10000000; timeout.tv_sec = 10;
timeout.tv_usec = 0; timeout.tv_usec = 0;
setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(void *)&timeout,sizeof(timeout)); setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(void *)&timeout,sizeof(timeout));
} }

Loading…
Cancel
Save