|
@ -319,6 +319,7 @@ void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr) |
|
|
nn_setsockopt(myinfo->dexsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); |
|
|
nn_setsockopt(myinfo->dexsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); |
|
|
nn_setsockopt(myinfo->repsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); |
|
|
nn_setsockopt(myinfo->repsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); |
|
|
printf("DEXINIT dex.%d rep.%d\n",myinfo->dexsock,myinfo->repsock); |
|
|
printf("DEXINIT dex.%d rep.%d\n",myinfo->dexsock,myinfo->repsock); |
|
|
|
|
|
myinfo->nanoinit = (uint32_t)time(NULL); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -640,6 +641,8 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo |
|
|
struct dpow_nanomsghdr *np; int32_t i,size,extralen=0,sentbytes = 0; uint32_t crc32; uint8_t extras[10000]; |
|
|
struct dpow_nanomsghdr *np; int32_t i,size,extralen=0,sentbytes = 0; uint32_t crc32; uint8_t extras[10000]; |
|
|
if ( bp->myind < 0 ) |
|
|
if ( bp->myind < 0 ) |
|
|
return; |
|
|
return; |
|
|
|
|
|
if ( time(NULL) < myinfo->nanoinit+5 ) |
|
|
|
|
|
return; |
|
|
crc32 = calc_crc32(0,data,datalen); |
|
|
crc32 = calc_crc32(0,data,datalen); |
|
|
//dp->crcs[firstz] = crc32;
|
|
|
//dp->crcs[firstz] = crc32;
|
|
|
size = (int32_t)(sizeof(*np) + datalen); |
|
|
size = (int32_t)(sizeof(*np) + datalen); |
|
@ -729,6 +732,8 @@ void dpow_ipbitsadd(struct supernet_info *myinfo,struct dpow_info *dp,uint32_t * |
|
|
void dpow_nanomsg_update(struct supernet_info *myinfo) |
|
|
void dpow_nanomsg_update(struct supernet_info *myinfo) |
|
|
{ |
|
|
{ |
|
|
int32_t i,n=0,num=0,size,firstz = -1; uint32_t crc32,r,m; struct dpow_nanomsghdr *np=0; struct dpow_info *dp; struct dpow_block *bp; struct dex_nanomsghdr *dexp = 0; |
|
|
int32_t i,n=0,num=0,size,firstz = -1; uint32_t crc32,r,m; struct dpow_nanomsghdr *np=0; struct dpow_info *dp; struct dpow_block *bp; struct dex_nanomsghdr *dexp = 0; |
|
|
|
|
|
if ( time(NULL) < myinfo->nanoinit+5 ) |
|
|
|
|
|
return; |
|
|
while ( (size= nn_recv(myinfo->dpowsock,&np,NN_MSG,0)) >= 0 ) |
|
|
while ( (size= nn_recv(myinfo->dpowsock,&np,NN_MSG,0)) >= 0 ) |
|
|
{ |
|
|
{ |
|
|
num++; |
|
|
num++; |
|
|