From 52bdb5310e2fce2884506710221388d3afaca9c7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 30 Mar 2016 04:13:00 -0300 Subject: [PATCH] test --- iguana/iguana777.c | 2 +- iguana/iguana777.h | 1 + iguana/iguana_bundles.c | 6 +++--- iguana/iguana_recv.c | 3 --- iguana/main.c | 4 +++- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/iguana/iguana777.c b/iguana/iguana777.c index cc0ec4fa0..8d3823f4a 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -541,7 +541,7 @@ void iguana_coinloop(void *arg) //fprintf(stderr,"metrics\n"); coin->peers.lastmetrics = iguana_updatemetrics(coin); // ranks peers } - iguana_bundlestats(coin,str,IGUANA_DEFAULTLAG); + //iguana_bundlestats(coin,str,IGUANA_DEFAULTLAG); if ( coin->longestchain+10000 > coin->blocks.maxbits ) iguana_recvalloc(coin,coin->longestchain + 100000); flag += iguana_processrecv(coin); diff --git a/iguana/iguana777.h b/iguana/iguana777.h index a9a70f634..af304c629 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -837,6 +837,7 @@ void iguana_spendvectorsQ(struct iguana_info *coin,struct iguana_bundle *bp); int8_t iguana_blockstatus(struct iguana_info *coin,struct iguana_block *block); void iguana_peerslotinit(struct iguana_info *coin,struct iguana_peer *addr,int32_t slotid,uint64_t ipbits); void iguana_blockunmark(struct iguana_info *coin,struct iguana_block *block,struct iguana_bundle *bp,int32_t i,int32_t deletefile); +int32_t iguana_reqblocks(struct iguana_info *coin); extern int32_t HDRnet,netBLOCKS; diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 98e4d3d94..9a16cc3d8 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -875,16 +875,16 @@ int32_t iguana_bundlemissings(struct iguana_info *coin,struct iguana_bundle *bp, if ( bp->numissued < bp->n ) max = bp->numissued; else max = bp->origmissings; - //if ( bp->missingstime == 0 || bp->numissued < bp->n || bp == coin->current || missing < max || time(NULL) > bp->missingstime+lag ) + if ( bp->missingstime == 0 || bp->numissued < bp->n || bp == coin->current || missing < max || time(NULL) > bp->missingstime+lag ) { if ( (n= iguana_bundlerequests(coin,missings,&bp->origmissings,&tmp,bp,lag)) > 0 ) { + printf("bundle.[%d] numissued.%d missings.%d n.%d capacity %d -> %d\n",bp->hdrsi,bp->numissued,bp->origmissings,n,capacity,capacity-n); bp->numissued += n; capacity -= n; bp->missingstime = (uint32_t)time(NULL); } } - printf("bundle.[%d] numissued.%d missings.%d n.%d capacity %d -> %d\n",bp->hdrsi,bp->numissued,bp->origmissings,n,capacity,capacity-n); return(capacity); } @@ -927,7 +927,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str,int32_t lag) } else { - if ( bp->hdrsi >= starti && bp->hdrsi < lasti && capacity > 0 ) + if ( bp->hdrsi >= starti && bp->hdrsi < lasti ) capacity = iguana_bundlemissings(coin,bp,capacity,lag); for (j=0; jn; j++) { diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index d3a80252d..ccccd82c3 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -1217,8 +1217,6 @@ int32_t iguana_processrecvQ(struct iguana_info *coin,int32_t *newhwmp) // single *newhwmp = 0; while ( coin->active != 0 && (req= queue_dequeue(&coin->recvQ,0)) != 0 ) { - if ( (flag % 100) == 50 ) - iguana_reqblocks(coin); flag++; //fprintf(stderr,"flag.%d %s recvQ.%p type.%c n.%d\n",flag,req->addr != 0 ? req->addr->ipaddr : "0",req,req->type,req->n); if ( req->type == 'B' ) // one block with all txdata @@ -1254,7 +1252,6 @@ int32_t iguana_processrecvQ(struct iguana_info *coin,int32_t *newhwmp) // single if ( flag >= IGUANA_BUNDLELOOP ) break; } - iguana_reqblocks(coin); return(flag); } diff --git a/iguana/main.c b/iguana/main.c index 0d179e59d..8480ef527 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -344,7 +344,7 @@ mksquashfs DB/BTC BTC.squash1M -b 1048576 void mainloop(struct supernet_info *myinfo) { - int32_t i,flag; struct iguana_info *coin; struct iguana_helper *ptr; struct iguana_bundle *bp; + int32_t i,flag; char str[65]; struct iguana_info *coin; struct iguana_helper *ptr; struct iguana_bundle *bp; sleep(3); printf("mainloop\n"); while ( 1 ) @@ -358,6 +358,8 @@ void mainloop(struct supernet_info *myinfo) //printf("main active.%d started.%p\n",coin->active,coin->started); if ( coin->active != 0 && coin->started != 0 ) { + iguana_bundlestats(coin,str,IGUANA_DEFAULTLAG); + iguana_reqblocks(coin); coin->RTramchain_busy = 1; if ( iguana_realtime_update(coin) > 0 ) flag++;