From b1474bae0b2aae833473b8a74204e4bb51b79674 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 25 Dec 2016 05:34:16 +0200 Subject: [PATCH] test --- iguana/dpow/dpow_network.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 0e81fef94..0925ef575 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -56,10 +56,15 @@ static int _increasing_ipbits(const void *a,const void *b) void dex_packet(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp,int32_t size) { - char *retstr; - printf("uniq DEX_PACKET.[%d] crc.%x lag.%d\n",size,calc_crc32(0,(void *)((long)dexp+sizeof(dexp->crc32)),(int32_t)(size-sizeof(dexp->crc32))),(int32_t)(time(NULL)-dexp->timestamp)); - if ( (retstr= basilisk_respond_addmessage(myinfo,dexp->packet,BASILISK_KEYSIZE,&dexp->packet[BASILISK_KEYSIZE],dexp->datalen-BASILISK_KEYSIZE,0,BASILISK_DEXDURATION)) != 0 ) - free(retstr); + char *retstr; int32_t i; + for (i=0; icrc32)),(int32_t)(size-sizeof(dexp->crc32))),(int32_t)(time(NULL)-dexp->timestamp),dexp->size,dexp->datalen); + if ( dexp->datalen > BASILISK_KEYSIZE ) + { + if ( (retstr= basilisk_respond_addmessage(myinfo,dexp->packet,BASILISK_KEYSIZE,&dexp->packet[BASILISK_KEYSIZE],dexp->datalen-BASILISK_KEYSIZE,0,BASILISK_DEXDURATION)) != 0 ) + free(retstr); + } } int32_t dex_reqsend(struct supernet_info *myinfo,uint8_t *data,int32_t datalen) @@ -118,6 +123,9 @@ int32_t dex_reqsend(struct supernet_info *myinfo,uint8_t *data,int32_t datalen) memcpy(dexp->packet,data,datalen); dexp->crc32 = calc_crc32(0,(void *)((long)dexp+sizeof(dexp->crc32)),(int32_t)(size-sizeof(dexp->crc32))); sentbytes = nn_send(myinfo->reqsock,dexp,size,0); + for (i=0; ireqsock,&retptr,NN_MSG,0)) >= 0 ) { ipbits = *retptr; @@ -198,7 +206,7 @@ int32_t dex_subsock_poll(struct supernet_info *myinfo) { if ( dex_packetcheck(myinfo,dexp,size) == 0 ) { - printf("SUBSOCK.%08x",dexp->crc32); + printf("SUBSOCK.%08x ",dexp->crc32); dex_packet(myinfo,dexp,size); } if ( dexp != 0 )