|
|
@ -627,11 +627,12 @@ void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr) |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
timeout = 3000; |
|
|
|
nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); |
|
|
|
timeout = 500; |
|
|
|
nn_setsockopt(repsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); |
|
|
|
nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); |
|
|
|
timeout = 10; |
|
|
|
nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); |
|
|
|
timeout = 200; |
|
|
|
timeout = 500; |
|
|
|
nn_setsockopt(repsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); |
|
|
|
maxsize = 1024 * 1024; |
|
|
|
printf("RCVBUF.%d\n",nn_setsockopt(dexsock,NN_SOL_SOCKET,NN_RCVBUF,&maxsize,sizeof(maxsize))); |
|
|
@ -645,7 +646,7 @@ void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr) |
|
|
|
} |
|
|
|
myinfo->dpowipbits[0] = (uint32_t)calc_ipbits(myinfo->ipaddr); |
|
|
|
myinfo->numdpowipbits = 1; |
|
|
|
timeout = 3000; |
|
|
|
timeout = 10; |
|
|
|
nn_setsockopt(dpowsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); |
|
|
|
maxsize = 1024 * 1024; |
|
|
|
printf("RCVBUF.%d\n",nn_setsockopt(dpowsock,NN_SOL_SOCKET,NN_RCVBUF,&maxsize,sizeof(maxsize))); |
|
|
@ -1122,7 +1123,7 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo |
|
|
|
np->srchash.bytes[i] = dp->minerkey33[i+1]; |
|
|
|
np->desthash = desthash; |
|
|
|
np->channel = channel; |
|
|
|
np->height = msgbits; |
|
|
|
np->height = bp->height;//msgbits;
|
|
|
|
np->myipbits = myinfo->myaddr.myipbits; |
|
|
|
strcpy(np->symbol,dp->symbol); |
|
|
|
np->version0 = DPOW_VERSION & 0xff; |
|
|
@ -1227,7 +1228,6 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo) |
|
|
|
} |
|
|
|
if ( dp != 0 && crc32 == np->crc32 ) |
|
|
|
{ |
|
|
|
//char str[65]; printf("%s RECV ht.%d ch.%08x (%d) crc32.%08x:%08x datalen.%d:%d firstz.%d\n",bits256_str(str,np->srchash),np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np)),firstz);
|
|
|
|
if ( i == myinfo->numdpows ) |
|
|
|
printf("received nnpacket for (%s)\n",np->symbol); |
|
|
|
else |
|
|
@ -1235,6 +1235,7 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo) |
|
|
|
dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,np->senderind,np->myipbits); |
|
|
|
if ( (bp= dpow_heightfind(myinfo,dp,np->height)) != 0 && bp->state != 0xffffffff && bp->myind >= 0 ) |
|
|
|
{ |
|
|
|
char str[65]; printf("%s RECV ht.%d ch.%08x (%d) crc32.%08x:%08x datalen.%d:%d firstz.%d i.%d senderind.%d myind.%d\n",bits256_str(str,np->srchash),np->height,np->channel,size,np->crc32,crc32,np->datalen,(int32_t)(size - sizeof(*np)),firstz,i,np->senderind,bp->myind); |
|
|
|
if ( np->senderind >= 0 && np->senderind < bp->numnotaries ) |
|
|
|
{ |
|
|
|
if ( memcmp(bp->notaries[np->senderind].pubkey+1,np->srchash.bytes,32) == 0 && bits256_nonz(np->srchash) != 0 ) |
|
|
@ -1245,12 +1246,12 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo) |
|
|
|
dpow_datahandler(myinfo,dp,bp,np->senderind,np->channel,np->height,np->packet,np->datalen); |
|
|
|
} else printf("wrong senderind.%d\n",np->senderind); |
|
|
|
} |
|
|
|
} |
|
|
|
} //else printf("height.%d bp.%p state.%x senderind.%d\n",np->height,bp,bp!=0?bp->state:0,np->senderind);
|
|
|
|
//dp->crcs[firstz] = crc32;
|
|
|
|
} |
|
|
|
} //else printf("crc error from.%d %x vs %x or no dp.%p [%s]\n",np->senderind,crc32,np->crc32,dp,np->symbol);
|
|
|
|
} //else printf("ignore.%d np->datalen.%d %d (size %d - %ld) [%s]\n",np->senderind,np->datalen,(int32_t)(size-sizeof(*np)),size,sizeof(*np),np->symbol);
|
|
|
|
} //else printf("wrong version from.%d %02x %02x size.%d [%s]\n",np->senderind,np->version0,np->version1,size,np->symbol);
|
|
|
|
} else printf("ignore.%d np->datalen.%d %d (size %d - %ld) [%s]\n",np->senderind,np->datalen,(int32_t)(size-sizeof(*np)),size,sizeof(*np),np->symbol); |
|
|
|
} else printf("wrong version from.%d %02x %02x size.%d [%s]\n",np->senderind,np->version0,np->version1,size,np->symbol); |
|
|
|
} else printf("illegal size.%d\n",size); |
|
|
|
if ( np != 0 ) |
|
|
|
nn_freemsg(np), np = 0; |
|
|
|