Browse Source

Revert connect timeout

pass-iguana-arg
jl777 7 years ago
parent
commit
c99b5d5f03
  1. 16
      iguana/exchanges/LP_socket.c

16
iguana/exchanges/LP_socket.c

@ -200,6 +200,8 @@ int32_t LP_socket(int32_t bindflag,char *hostname,uint16_t port)
#endif #endif
#endif #endif
if ( bindflag == 0 ) if ( bindflag == 0 )
{
if ( 0 )
{ {
uint32_t starttime = (uint32_t)time(NULL); uint32_t starttime = (uint32_t)time(NULL);
//printf("call connect sock.%d\n",sock); //printf("call connect sock.%d\n",sock);
@ -207,10 +209,14 @@ int32_t LP_socket(int32_t bindflag,char *hostname,uint16_t port)
//printf("called connect result.%d lag.%d\n",result,(int32_t)(time(NULL) - starttime)); //printf("called connect result.%d lag.%d\n",result,(int32_t)(time(NULL) - starttime));
if ( result < 0 ) if ( result < 0 )
return(-1); return(-1);
timeout.tv_sec = 2; 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));
/*if ( result != 0 ) }
else
{
result = connect(sock,(struct sockaddr *)&saddr,addrlen);
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 )
{ {
@ -219,10 +225,8 @@ int32_t LP_socket(int32_t bindflag,char *hostname,uint16_t port)
if ( sock >= 0 ) if ( sock >= 0 )
closesocket(sock); closesocket(sock);
return(-1); return(-1);
}*/ }
timeout.tv_sec = 10; }
timeout.tv_usec = 0;
setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(void *)&timeout,sizeof(timeout));
} }
else else
{ {

Loading…
Cancel
Save