From 35c686573a167b2f4cf5974db4c48161d38acb9f Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 8 Apr 2016 01:31:33 -0500 Subject: [PATCH] test --- iguana/iguana777.h | 8 ++++---- iguana/iguana_bundles.c | 29 +++++++++++++++++------------ iguana/iguana_peers.c | 2 +- iguana/main.c | 2 +- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/iguana/iguana777.h b/iguana/iguana777.h index cf8c580e1..72d063122 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -76,13 +76,13 @@ struct iguana_txdatabits { uint64_t addrind:IGUANA_LOG2MAXPEERS,filecount:10,fpo #define IGUANA_DEDICATED_THREADS #ifdef IGUANA_DEDICATED_THREADS -#define IGUANA_MAXCONNTHREADS 32 +#define IGUANA_MAXCONNTHREADS 16 #define IGUANA_MAXSENDTHREADS (IGUANA_MAXPEERS>>2) #define IGUANA_MAXRECVTHREADS (IGUANA_MAXPEERS>>2) #else -#define IGUANA_MAXCONNTHREADS 64 -#define IGUANA_MAXSENDTHREADS 64 -#define IGUANA_MAXRECVTHREADS 64 +#define IGUANA_MAXCONNTHREADS 16 +#define IGUANA_MAXSENDTHREADS 16 +#define IGUANA_MAXRECVTHREADS 16 #endif diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 7c12ee300..5fe28726e 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -537,7 +537,7 @@ int32_t iguana_bundleissuemissing(struct iguana_info *coin,struct iguana_bundle if ( firsti < 0 ) firsti = i; lasti = i; - if ( bp->numsaved > bp->n-10 || ((bp->issued[i] == 0 || bp->issued[i] > 1) && now > bp->issued[i]+lag) ) + if ( priority > 2 || bp->numsaved > bp->n-1 || ((bp->issued[i] == 0 || bp->issued[i] > 1) && now > bp->issued[i]+lag) ) { iguana_bundleblock(coin,&hash2,bp,i); if ( bits256_nonz(hash2) != 0 ) @@ -547,19 +547,24 @@ int32_t iguana_bundleissuemissing(struct iguana_info *coin,struct iguana_bundle if ( (addr= coin->peers.ranked[rand() % max]) != 0 && addr->usock >= 0 && addr->dead == 0 ) { struct iguana_blockreq *req = 0; - req = mycalloc('y',1,sizeof(*req)); - req->hash2 = hash2; - req->bp = bp; - req->height = bp->bundleheight + i; - req->bundlei = i; - bp->issued[i] = 1; - queue_enqueue("missing",&coin->priorityQ,&req->DL,0); + if ( priority > 2 ) + iguana_sendblockreqPT(coin,addr,bp,i,hash2,0); + else + { + req = mycalloc('y',1,sizeof(*req)); + req->hash2 = hash2; + req->bp = bp; + req->height = bp->bundleheight + i; + req->bundlei = i; + bp->issued[i] = 1; + queue_enqueue("missing",&coin->priorityQ,&req->DL,0); + } n++; } } } } - if ( firsti >= 0 && (coin->enableCACHE != 0 || bp == coin->current) ) + if ( priority <= 2 && firsti >= 0 && (coin->enableCACHE != 0 || bp == coin->current) ) { //printf("[%d] first missing.%d of %d\n",bp->hdrsi,firsti,nonz); iguana_bundleblock(coin,&hash2,bp,firsti); @@ -638,7 +643,7 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32 } if ( coin->enableCACHE != 0 && (bp == coin->current || bp->hdrsi == coin->bundlescount-1) && bits256_nonz(bp->nextbundlehash2) == 0 ) { - iguana_bundleissuemissing(coin,bp,1,.1); + iguana_bundleissuemissing(coin,bp,3,1.); /*if ( bp == coin->current ) { mult = 1.; @@ -1127,11 +1132,11 @@ void iguana_bundlestats(struct iguana_info *coin,char *str,int32_t lag) myfree(breq,sizeof(*breq)); while ( (breq= queue_dequeue(&coin->priorityQ,0)) != 0 ) myfree(breq,sizeof(*breq)); - for (i=0; in; i++) + /*for (i=0; in; i++) { if ( (block= bp->blocks[i]) != 0 && block->txvalid == 0 ) iguana_blockQ("stuck",coin,bp,i,block->RO.hash2,1); - } + }*/ } if ( (n= iguana_bundleissuemissing(coin,bp,1,1.)) > 0 ) printf("issued %d priority requests [%d] to unstick stuckiters.%d lag.%d\n",n,bp->hdrsi,coin->stuckiters,lag); diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index e1d84dfbb..6637b56c0 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -1051,7 +1051,7 @@ void iguana_dedicatedloop(struct iguana_info *coin,struct iguana_peer *addr) run = 0; while ( addr->usock >= 0 && addr->dead == 0 && coin->peers.shuttingdown == 0 ) { - if ( 1 && (req= queue_dequeue(&coin->cacheQ,0)) != 0 ) + if ( 0 && (req= queue_dequeue(&coin->cacheQ,0)) != 0 ) { if ( req->datalen != 0 ) { diff --git a/iguana/main.c b/iguana/main.c index 569624e0a..9880f427e 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -1197,7 +1197,7 @@ void iguana_main(void *arg) if ( 1 ) { sleep(1); - if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"VALIDATE\":1,\"prefetchlag\":13,\"startpend\":2048,\"endpend\":2048,\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":0,\"maxpeers\":256,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":8,\"poll\":10}"),0,myinfo->rpcport)) != 0 ) + if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"VALIDATE\":1,\"prefetchlag\":13,\"startpend\":2048,\"endpend\":2048,\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":0,\"maxpeers\":64,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":8,\"poll\":10}"),0,myinfo->rpcport)) != 0 ) { free(str); if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":1024,\"maxpeers\":256,\"newcoin\":\"BTCD\",\"active\":1}"),0,myinfo->rpcport)) != 0 )