|
|
@ -70,7 +70,7 @@ int32_t signed_nn_recv(void **freeptrp,void *ctx,uint8_t notaries[64][33],int32_ |
|
|
|
{ |
|
|
|
*(void **)packetp = (void **)((uint64_t)sigpacket + sizeof(*sigpacket)); |
|
|
|
*freeptrp = sigpacket; |
|
|
|
//printf("got signed packet from notary0\n");
|
|
|
|
printf("got signed packet from notary0\n"); |
|
|
|
return((int32_t)(recvbytes - sizeof(*sigpacket))); |
|
|
|
} |
|
|
|
for (i=0; i<n && i<64; i++) |
|
|
@ -78,7 +78,7 @@ int32_t signed_nn_recv(void **freeptrp,void *ctx,uint8_t notaries[64][33],int32_ |
|
|
|
if ( memcmp(pubkey33,notaries[i],33) == 0 ) |
|
|
|
{ |
|
|
|
*(void **)packetp = (void **)((uint64_t)sigpacket + sizeof(*sigpacket)); |
|
|
|
//printf("got signed packet from notary.%d\n",i);
|
|
|
|
printf("got signed packet from notary.%d\n",i); |
|
|
|
*freeptrp = sigpacket; |
|
|
|
return((int32_t)(recvbytes - sizeof(*sigpacket))); |
|
|
|
} |
|
|
@ -204,7 +204,7 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int3 |
|
|
|
{ |
|
|
|
timeout = 100; |
|
|
|
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); |
|
|
|
timeout = 1000; |
|
|
|
timeout = 2000; |
|
|
|
nn_setsockopt(reqsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); |
|
|
|
//nn_setsockopt(reqsock,NN_TCP,NN_RECONNECT_IVL,&timeout,sizeof(timeout));
|
|
|
|
if ( myinfo->IAMNOTARY == 0 && subsock < 0 && (subsock= nn_socket(AF_SP,NN_SUB)) >= 0 ) |
|
|
@ -296,7 +296,8 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int3 |
|
|
|
printf("%d: subscribe connect (%s)\n",myinfo->numdexipbits,str); |
|
|
|
} |
|
|
|
} |
|
|
|
//nn_connect(myinfo->reqsock,nanomsg_tcpname(0,str,ipaddr,REP_SOCK));
|
|
|
|
nanomsg_tcpname(0,str,ipaddr,REP_SOCK); |
|
|
|
//nn_connect(myinfo->reqsock,str);
|
|
|
|
printf("%d: req connect (%s)\n",myinfo->numdexipbits,str); |
|
|
|
} |
|
|
|
} |
|
|
@ -485,7 +486,7 @@ char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32 |
|
|
|
{ |
|
|
|
if ( (retstrs[j]= _dex_reqsend(myinfo,handler,data,datalen)) != 0 ) |
|
|
|
{ |
|
|
|
//printf("j.%d of max.%d M.%d (%s)\n",j,max,M,retstrs[j]);
|
|
|
|
printf("j.%d of max.%d M.%d (%s)\n",j,max,M,retstrs[j]); |
|
|
|
if ( strncmp(retstrs[j],"{\"error\":\"null return\"}",strlen("{\"error\":\"null return\"}")) != 0 && strncmp(retstrs[j],"[]",strlen("[]")) != 0 && strcmp("0",retstrs[j]) != 0 ) |
|
|
|
{ |
|
|
|
if ( ++j == M ) |
|
|
@ -1564,7 +1565,7 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo) |
|
|
|
break; |
|
|
|
usleep(1000); |
|
|
|
}*/ |
|
|
|
while ( (size= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->dpowsock,&np)) >= 0 && num < 100 ) |
|
|
|
while ( (size= signed_nn_recv(&freeptr,myinfo->ctx,myinfo->notaries,myinfo->numnotaries,myinfo->dpowsock,&np)) >= 0 && num < 300 ) |
|
|
|
{ |
|
|
|
num++; |
|
|
|
if ( size > 0 ) |
|
|
|