|
|
@ -277,7 +277,7 @@ void dex_packet(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp,int32_t |
|
|
|
|
|
|
|
char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *key,int32_t keylen,uint8_t *data,int32_t datalen) |
|
|
|
{ |
|
|
|
struct dex_nanomsghdr *dexp; cJSON *retjson; char ipaddr[64],str[128]; int32_t timeout,i,n,size,recvbytes,sentbytes = 0,reqsock,subsock; uint32_t *retptr,ipbits; void *freeptr; char *retstr = 0; |
|
|
|
struct dex_nanomsghdr *dexp; cJSON *retjson; char ipaddr[64],str[128]; int32_t prio,timeout,i,n,size,recvbytes,sentbytes = 0,reqsock,subsock; uint32_t *retptr,ipbits; void *freeptr; char *retstr = 0; |
|
|
|
portable_mutex_lock(&myinfo->dexmutex); |
|
|
|
subsock = myinfo->subsock; |
|
|
|
reqsock = myinfo->reqsock; |
|
|
@ -287,17 +287,25 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *key,int32 |
|
|
|
{ |
|
|
|
timeout = 1000; |
|
|
|
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); |
|
|
|
//timeout = 5000;
|
|
|
|
//nn_setsockopt(reqsock,NN_TCP,NN_RECONNECT_IVL,&timeout,sizeof(timeout));
|
|
|
|
timeout = 500; |
|
|
|
nn_setsockopt(reqsock,NN_TCP,NN_RECONNECT_IVL,&timeout,sizeof(timeout)); |
|
|
|
timeout = 1000; |
|
|
|
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); |
|
|
|
prio = 1; |
|
|
|
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_SNDPRIO,&prio,sizeof(prio)); |
|
|
|
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_RCVPRIO,&prio,sizeof(prio)); |
|
|
|
for (i=0; i<sizeof(myinfo->dexseed_ipaddrs)/sizeof(*myinfo->dexseed_ipaddrs); i++) |
|
|
|
{ |
|
|
|
if ( nn_connect(reqsock,nanomsg_tcpname(0,str,myinfo->dexseed_ipaddrs[i],REP_SOCK)) < 0 ) |
|
|
|
{ |
|
|
|
nn_close(reqsock); |
|
|
|
reqsock = -1; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
prio = 8; |
|
|
|
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_SNDPRIO,&prio,sizeof(prio)); |
|
|
|
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_RCVPRIO,&prio,sizeof(prio)); |
|
|
|
} |
|
|
|
if ( reqsock >= 0 ) |
|
|
|
{ |
|
|
|