From 6a88a0b19cbb39e3aa0a5ee8feb81dd71309c989 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 Jan 2017 21:09:52 +0200 Subject: [PATCH] test --- iguana/dpow/dpow_network.c | 25 ++++++++++++++++++------- iguana/dpow/dpow_rpc.c | 2 +- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 30ac38cbf..fe4962100 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -371,19 +371,30 @@ char *dex_response(int32_t *broadcastflagp,struct supernet_info *myinfo,struct d char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen,int32_t M) { - char *retstr = 0; int32_t i,max = myinfo->numdexipbits; - for (i=0; i<=max; i++) + char *retstrs[64]; int32_t i,j,max = myinfo->numdexipbits; + memset(retstrs,0,sizeof(retstrs)); + for (i=j=0; i<=max; i++) { - if ( (retstr= _dex_reqsend(myinfo,handler,data,datalen)) != 0 ) + if ( (retstrs[j]= _dex_reqsend(myinfo,handler,data,datalen)) != 0 ) { - if ( strncmp(retstr,"{\"error\":\"null return\"}",strlen("{\"error\":\"null return\"}")) != 0 ) - break; + if ( strncmp(retstrs[j],"{\"error\":\"null return\"}",strlen("{\"error\":\"null return\"}")) != 0 ) + { + if ( ++j == M ) + break; + } else if ( i < max ) - free(retstr); + free(retstrs[j]); } //printf("automatic retry.%d of %d\n",i,max); } - return(retstr); + if ( j == 1 ) + return(retstrs[0]); + else + { + for (i=0; iFULLNODE < 0 ) { sprintf(buf,"[\"%s\", \"%s\", false]",address,address);