Browse Source

Even faster

etomic
jl777 8 years ago
parent
commit
aa9d283735
  1. 16
      iguana/dpow/dpow_network.c
  2. 5
      iguana/tests/loop

16
iguana/dpow/dpow_network.c

@ -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,18 +287,26 @@ 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 )
{
if ( myinfo->IAMNOTARY == 0 && subsock < 0 && (subsock= nn_socket(AF_SP,NN_SUB)) >= 0 )

5
iguana/tests/loop

@ -1,8 +1,7 @@
#!/bin/bash
pkill iguana
while true
do
../../agents/iguana
sleep 3
./dexlistunspent
./dexgetinfo
done

Loading…
Cancel
Save