Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
00326dae4e
  1. 12
      iguana/iguana777.c

12
iguana/iguana777.c

@ -714,12 +714,12 @@ void iguana_coinloop(void *arg)
if ( coin->MAXPEERS > IGUANA_MINPEERS ) if ( coin->MAXPEERS > IGUANA_MINPEERS )
coin->MAXPEERS = IGUANA_MINPEERS; coin->MAXPEERS = IGUANA_MINPEERS;
} }
if ( coin->isRT != 0 && coin->current != 0 && coin->numverified >= coin->current->hdrsi ) /*if ( coin->isRT != 0 && coin->current != 0 && coin->numverified >= coin->current->hdrsi )
{ {
//static int32_t saved; //static int32_t saved;
//if ( saved++ == 0 ) //if ( saved++ == 0 )
// iguana_coinflush(coin,1); // iguana_coinflush(coin,1);
} }*/
if ( coin->bindsock >= 0 ) if ( coin->bindsock >= 0 )
{ {
if ( coin->MAXPEERS > 1 && coin->peers->numranked < IGUANA_MAXPEERS/2 && now > coin->lastpossible+10 ) if ( coin->MAXPEERS > 1 && coin->peers->numranked < IGUANA_MAXPEERS/2 && now > coin->lastpossible+10 )
@ -734,6 +734,7 @@ void iguana_coinloop(void *arg)
{ {
if ( coin->MAXPEERS > 1 && coin->peers->numranked < ((7*coin->MAXPEERS)>>3) && now > coin->lastpossible+10 ) if ( coin->MAXPEERS > 1 && coin->peers->numranked < ((7*coin->MAXPEERS)>>3) && now > coin->lastpossible+10 )
{ {
printf("%s send ping? %d\n",coin->symbol,coin->peers != 0 ? coin->peers->numranked : -1);
if ( coin->peers->numranked > 0 && (now % 60) == 0 ) if ( coin->peers->numranked > 0 && (now % 60) == 0 )
iguana_send_ping(myinfo,coin,coin->peers->ranked[rand() % coin->peers->numranked]); iguana_send_ping(myinfo,coin,coin->peers->ranked[rand() % coin->peers->numranked]);
coin->lastpossible = iguana_possible_peer(coin,0); // tries to connect to new peers coin->lastpossible = iguana_possible_peer(coin,0); // tries to connect to new peers
@ -741,13 +742,15 @@ void iguana_coinloop(void *arg)
} }
if ( coin->MAXPEERS > 1 && now > coin->peers->lastmetrics+10 ) if ( coin->MAXPEERS > 1 && now > coin->peers->lastmetrics+10 )
{ {
//fprintf(stderr,"metrics\n"); fprintf(stderr,"%s call updatemetrics\n",coin->symbol);
coin->peers->lastmetrics = iguana_updatemetrics(myinfo,coin); // ranks peers coin->peers->lastmetrics = iguana_updatemetrics(myinfo,coin); // ranks peers
fprintf(stderr,"%s back updatemetrics\n",coin->symbol);
} }
//if ( coin->longestchain+10000 > coin->blocks.maxbits ) //if ( coin->longestchain+10000 > coin->blocks.maxbits )
// iguana_recvalloc(coin,coin->longestchain + 100000); // iguana_recvalloc(coin,coin->longestchain + 100000);
if ( coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 || coin->MAXPEERS == 1 ) if ( coin->RELAYNODE != 0 || coin->VALIDATENODE != 0 || coin->MAXPEERS == 1 )
{ {
printf("%s call processrecv\n",coin->symbol);
flag += iguana_processrecv(myinfo,coin); flag += iguana_processrecv(myinfo,coin);
if ( coin->RTheight > 0 && coin->RTheight > coin->chain->bundlesize ) if ( coin->RTheight > 0 && coin->RTheight > coin->chain->bundlesize )
{ {
@ -757,12 +760,13 @@ void iguana_coinloop(void *arg)
bp->weights = iguana_PoS_weights(myinfo,coin,&refP,&bp->supply,&bp->numweights,&nonz,&errs,bp->bundleheight); bp->weights = iguana_PoS_weights(myinfo,coin,&refP,&bp->supply,&bp->numweights,&nonz,&errs,bp->bundleheight);
} }
} }
printf("%s call jsonQ\n",coin->symbol);
iguana_jsonQ(); iguana_jsonQ();
} else printf("skip %s\n",coin->symbol); } else printf("skip %s\n",coin->symbol);
coin->idletime = (uint32_t)time(NULL); coin->idletime = (uint32_t)time(NULL);
} }
} }
printf("flag.%d isRT.%d polltimeout.%d numranked.%d\n",flag,coin->isRT,coin->polltimeout,coin->peers->numranked); printf("%s flag.%d isRT.%d polltimeout.%d numranked.%d\n",coin->symbol,flag,coin->isRT,coin->polltimeout,coin->peers->numranked);
if ( flag == 0 && coin->isRT == 0 && coin->peers != 0 ) if ( flag == 0 && coin->isRT == 0 && coin->peers != 0 )
usleep(coin->polltimeout*1000 + (coin->peers->numranked == 0)*1000000); usleep(coin->polltimeout*1000 + (coin->peers->numranked == 0)*1000000);
else if ( coin->current != 0 && coin->current->hdrsi == coin->longestchain/coin->chain->bundlesize ) else if ( coin->current != 0 && coin->current->hdrsi == coin->longestchain/coin->chain->bundlesize )

Loading…
Cancel
Save