Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
b105924d29
  1. 12
      iguana/iguana_bundles.c
  2. 15
      iguana/iguana_recv.c
  3. 2
      iguana/main.c

12
iguana/iguana_bundles.c

@ -581,8 +581,8 @@ void iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_
{ {
if ( block->fpipbits == 0 && (block->queued == 0 || bp->issued[i] == 0 || now > bp->issued[i]+1) ) if ( block->fpipbits == 0 && (block->queued == 0 || bp->issued[i] == 0 || now > bp->issued[i]+1) )
{ {
if ( bp->bundleheight == 20000 ) //if ( bp->bundleheight == 20000 )
printf("(%d:%d) ",bp->hdrsi,i); // printf("(%d:%d) ",bp->hdrsi,i);
iguana_blockQ(coin,bp,i,block->RO.hash2,bp->numsaved > bp->n-10); iguana_blockQ(coin,bp,i,block->RO.hash2,bp->numsaved > bp->n-10);
bp->issued[i] = now; bp->issued[i] = now;
counter++; counter++;
@ -594,7 +594,8 @@ void iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_
} }
usleep(10000); usleep(10000);
} }
printf("ITERATE bundle.%d n.%d r.%d s.%d finished.%d\n",bp->bundleheight,bp->n,bp->numrecv,bp->numsaved,bp->emitfinish); if ( counter > 0 )
printf("ITERATE bundle.%d n.%d r.%d s.%d finished.%d issued.%d\n",bp->bundleheight,bp->n,bp->numrecv,bp->numsaved,bp->emitfinish,counter);
if ( bp->emitfinish == 0 ) if ( bp->emitfinish == 0 )
{ {
if ( bp->numsaved >= bp->n ) if ( bp->numsaved >= bp->n )
@ -602,8 +603,9 @@ void iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_
printf(">>>>>>>>>>>>>>>>>>>>>>> EMIT bundle.%d\n",bp->bundleheight); printf(">>>>>>>>>>>>>>>>>>>>>>> EMIT bundle.%d\n",bp->bundleheight);
bp->emitfinish = 1; bp->emitfinish = 1;
iguana_emitQ(coin,bp); iguana_emitQ(coin,bp);
coin->numbundlesQ--;
return; return;
} }
iguana_bundleQ(coin,bp,counter == 0 ? 5000 : 1000); iguana_bundleQ(coin,bp,counter == 0 ? bp->n*5 : bp->n*2);
} } else coin->numbundlesQ--;
} }

15
iguana/iguana_recv.c

@ -309,7 +309,7 @@ uint32_t iguana_allhashcmp(struct iguana_info *coin,struct iguana_bundle *bp,bit
// iguana_blockQ(coin,bp,i,block->RO.hash2,1), n++; // iguana_blockQ(coin,bp,i,block->RO.hash2,1), n++;
} }
//printf("ALLHASHES FOUND! %d requested.%d\n",bp->bundleheight,n); //printf("ALLHASHES FOUND! %d requested.%d\n",bp->bundleheight,n);
iguana_bundleQ(coin,bp,500 + (rand() % 500)); iguana_bundleQ(coin,bp,bp->n*2 + (rand() % 500));
return(bp->queued); return(bp->queued);
} }
} }
@ -657,20 +657,13 @@ int32_t iguana_blockQ(struct iguana_info *coin,struct iguana_bundle *bp,int32_t
if ( block->fpipbits != 0 || block->queued != 0 ) if ( block->fpipbits != 0 || block->queued != 0 )
return(0); return(0);
block->numrequests++; block->numrequests++;
/*if ( block->rawdata != 0 && block->RO.recvlen != 0 )
{
printf("free cached copy recvlen.%d need to process it here\n",block->RO.recvlen);
myfree(block->rawdata,block->RO.recvlen);
block->rawdata = 0;
block->RO.recvlen = 0;
}*/
} }
if ( priority != 0 ) if ( priority != 0 )
str = "priorityQ", Q = &coin->priorityQ; str = "priorityQ", Q = &coin->priorityQ;
else str = "blocksQ", Q = &coin->blocksQ; else str = "blocksQ", Q = &coin->blocksQ;
if ( Q != 0 ) if ( Q != 0 )
{ {
req = mycalloc('r',1,sizeof(*req)); req = mycalloc('y',1,sizeof(*req));
req->hash2 = hash2; req->hash2 = hash2;
req->bp = bp; req->bp = bp;
req->bundlei = bundlei; req->bundlei = bundlei;
@ -695,7 +688,7 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
{ {
uint8_t serialized[sizeof(struct iguana_msghdr) + sizeof(uint32_t)*32 + sizeof(bits256)]; uint8_t serialized[sizeof(struct iguana_msghdr) + sizeof(uint32_t)*32 + sizeof(bits256)];
char *hashstr=0; bits256 hash2; uint32_t now; struct iguana_block *block; struct iguana_blockreq *req=0; char *hashstr=0; bits256 hash2; uint32_t now; struct iguana_block *block; struct iguana_blockreq *req=0;
struct iguana_bundle *bp; struct iguana_peer *ptr; int32_t i,m,z,pend,limit,height=-1,bundlei,datalen,flag = 0; struct iguana_bundle *bp; struct iguana_peer *ptr; int32_t priority,i,m,z,pend,limit,height=-1,bundlei,datalen,flag = 0;
if ( addr->msgcounts.verack == 0 ) if ( addr->msgcounts.verack == 0 )
return(0); return(0);
now = (uint32_t)time(NULL); now = (uint32_t)time(NULL);
@ -745,7 +738,6 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
//if ( addr->pendblocks >= limit ) //if ( addr->pendblocks >= limit )
// printf("%s %d overlimit.%d\n",addr->ipaddr,addr->pendblocks,limit); // printf("%s %d overlimit.%d\n",addr->ipaddr,addr->pendblocks,limit);
req = queue_dequeue(&coin->priorityQ,0); req = queue_dequeue(&coin->priorityQ,0);
int32_t priority;
if ( addr->rank != 1 && req == 0 && addr->pendblocks < limit ) if ( addr->rank != 1 && req == 0 && addr->pendblocks < limit )
{ {
priority = 0; priority = 0;
@ -832,6 +824,7 @@ int32_t iguana_processrecv(struct iguana_info *coin) // single threaded
{ {
coin->backstopmillis = OS_milliseconds(); coin->backstopmillis = OS_milliseconds();
iguana_blockQ(coin,bp,bundlei,iguana_blockhash(coin,coin->backstop),0); iguana_blockQ(coin,bp,bundlei,iguana_blockhash(coin,coin->backstop),0);
flag++;
if ( (rand() % 100) == 0 ) if ( (rand() % 100) == 0 )
printf("MAINCHAIN.%d threshold %.3f %.3f lag %.3f\n",coin->blocks.hwmchain.height+1,threshold,coin->backstopmillis,lag); printf("MAINCHAIN.%d threshold %.3f %.3f lag %.3f\n",coin->blocks.hwmchain.height+1,threshold,coin->backstopmillis,lag);
} }

2
iguana/main.c

@ -37,7 +37,7 @@ static int32_t initflag;
#ifdef __linux__ #ifdef __linux__
int32_t IGUANA_NUMHELPERS = 16; int32_t IGUANA_NUMHELPERS = 16;
#else #else
int32_t IGUANA_NUMHELPERS = 16; int32_t IGUANA_NUMHELPERS = 4;
#endif #endif
char *hash_parser(struct supernet_info *myinfo,char *hashname,cJSON *json,char *remoteaddr) char *hash_parser(struct supernet_info *myinfo,char *hashname,cJSON *json,char *remoteaddr)

Loading…
Cancel
Save