From f8f7e11ab4f72a864810071fa21b936d57a1f017 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 20 Mar 2016 02:13:28 -0300 Subject: [PATCH] test --- iguana/iguana777.c | 7 ++++--- iguana/iguana777.h | 2 +- iguana/iguana_bundles.c | 2 +- iguana/iguana_recv.c | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 25f356e9e..866b1232c 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -368,8 +368,9 @@ void iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp) void iguana_helper(void *arg) { - FILE *fp = 0; char fname[512],name[64],*helpername = 0; cJSON *argjson=0; int32_t flag,idle=0; + FILE *fp = 0; char fname[512],name[64],*helpername = 0; cJSON *argjson=0; int32_t type,flag,idle=0; struct iguana_helper *ptr; struct iguana_info *coin; struct OS_memspace MEM,*MEMB; + type = rand(); if ( arg != 0 && (argjson= cJSON_Parse(arg)) != 0 ) helpername = jstr(argjson,"name"); if ( helpername == 0 ) @@ -388,7 +389,7 @@ void iguana_helper(void *arg) { //iguana_jsonQ(); flag = 0; - if ( (ptr= queue_dequeue(&emitQ,0)) != 0 || (ptr= queue_dequeue(&helperQ,0)) != 0 ) + if ( (type % 2) == 0 && ((ptr= queue_dequeue(&emitQ,0)) != 0 || (ptr= queue_dequeue(&helperQ,0)) != 0) ) { if ( ptr->bp != 0 && (coin= ptr->coin) != 0 ) { @@ -400,7 +401,7 @@ void iguana_helper(void *arg) } myfree(ptr,ptr->allocsize); } - else if ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 ) + else if ( (type % 2) == 1 && (ptr= queue_dequeue(&bundlesQ,0)) != 0 ) { idle = 0; if ( ptr->bp != 0 && ptr->coin != 0 ) diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 8b0d44cdb..3dba09a3f 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -39,7 +39,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t #define IGUANA_MAXPENDHDRS 1 #define _IGUANA_MAXPENDING 3 #define IGUANA_MINPENDBUNDLES 16 -#define IGUANA_MAXPENDBUNDLES 64 +#define IGUANA_MAXPENDBUNDLES 100 #define IGUANA_BUNDLELOOP 77 #define IGUANA_RPCPORT 7778 #define IGUANA_MAXRAMCHAINSIZE ((uint64_t)1024L * 1024L * 1024L * 16) diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index f58e8111e..798b5e345 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -153,7 +153,7 @@ int32_t iguana_hash2set(struct iguana_info *coin,char *debugstr,struct iguana_bu bit = iguana_calcbloom(newhash2); if ( iguana_bloomfind(coin,&bp->bloom,0,bit) < 0 ) { - //printf("bloomset (%s)\n",bits256_str(str,newhash2)); + printf("bloomset (%s) -> [%d:%d]\n",bits256_str(str,newhash2),bp->hdrsi,bundlei); iguana_bloomset(coin,&bp->bloom,0,bit); if ( 0 ) { diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 21a8f3587..8c7ef9981 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -571,7 +571,7 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct //iguana_blockQ(coin,0,-1,blockhashes[1],0); //iguana_blockQ(coin,0,-4,blockhashes[1],1); char str[65]; - if ( bp != 0 && num > 2 )//&& bp->hdrsi == coin->bundlescount-1 ) + if ( num > 2 )//&& bp->hdrsi == coin->bundlescount-1 ) printf("blockhashes[%d] %d of %d %s bp.%d[%d]\n",num,bp==0?-1:bp->hdrsi,coin->bundlescount,bits256_str(str,blockhashes[1]),bp==0?-1:bp->bundleheight,bundlei); if ( bp != 0 ) { @@ -941,7 +941,7 @@ int32_t iguana_reqhdrs(struct iguana_info *coin) int32_t i,lag,n = 0; struct iguana_bundle *bp; char hashstr[65]; if ( queue_size(&coin->hdrsQ) == 0 ) { - if ( iguana_needhdrs(coin) > 0 ) + //if ( iguana_needhdrs(coin) > 0 ) { for (i=0; ibundlescount; i++) { @@ -1066,7 +1066,7 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr) } if ( bp == 0 || z != 0 ) { - //printf("%s request HDR.(%s) numhashes.%d\n",addr!=0?addr->ipaddr:"local",hashstr,bp!=0?bp->numhashes:0); + printf("%s request HDR.(%s) numhashes.%d\n",addr!=0?addr->ipaddr:"local",hashstr,bp!=0?bp->numhashes:0); iguana_send(coin,addr,serialized,datalen); addr->pendhdrs++; flag++;