|
@ -286,8 +286,8 @@ void iguana_iAkill(struct iguana_info *coin,struct iguana_peer *addr,int32_t mar |
|
|
|
|
|
|
|
|
int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port) |
|
|
int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port) |
|
|
{ |
|
|
{ |
|
|
int32_t opt,sock,result; uint32_t ipbits; char ipaddr[64]; struct timeval timeout; |
|
|
int32_t opt,sock,result; uint32_t ipbits; char ipaddr[64]; //struct timeval timeout;
|
|
|
struct sockaddr_in saddr; socklen_t addrlen; |
|
|
struct sockaddr_in saddr; socklen_t addrlen,slen; |
|
|
addrlen = sizeof(saddr); |
|
|
addrlen = sizeof(saddr); |
|
|
struct hostent *hostent = gethostbyname(hostname); |
|
|
struct hostent *hostent = gethostbyname(hostname); |
|
|
if ( hostent == NULL ) |
|
|
if ( hostent == NULL ) |
|
@ -317,7 +317,10 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port) |
|
|
//timeout.tv_sec = 0;
|
|
|
//timeout.tv_sec = 0;
|
|
|
//timeout.tv_usec = 1000;
|
|
|
//timeout.tv_usec = 1000;
|
|
|
//setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(char *)&timeout,sizeof(timeout));
|
|
|
//setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(char *)&timeout,sizeof(timeout));
|
|
|
setsockopt(sock,SOL_SOCKET,SO_KEEPALIVE,(void *)&opt,sizeof(opt)); |
|
|
setsockopt(sock,SOL_SOCKET,SO_KEEPALIVE,(void *)&opt,(int32_t)sizeof(opt)); |
|
|
|
|
|
opt = 0; |
|
|
|
|
|
getsockopt(sock,SOL_SOCKET,SO_KEEPALIVE,(void *)&opt,&slen); |
|
|
|
|
|
printf("keepalive.%d\n",opt); |
|
|
} |
|
|
} |
|
|
setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(void *)&opt,sizeof(opt)); |
|
|
setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(void *)&opt,sizeof(opt)); |
|
|
#ifdef __APPLE__ |
|
|
#ifdef __APPLE__ |
|
|