diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 7f5ee4aad..ab51eaa4a 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -319,7 +319,7 @@ void iguana_helper(void *arg) MEMB = mycalloc('b',IGUANA_MAXBUNDLESIZE,sizeof(*MEMB)); while ( 1 ) { - iguana_jsonQ(); + //iguana_jsonQ(); flag = 0; if ( (ptr= queue_dequeue(&helperQ,0)) != 0 ) { diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index 677383afd..077f64d76 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -925,6 +925,8 @@ void iguana_dedicatedloop(struct iguana_info *coin,struct iguana_peer *addr) bufsize = IGUANA_MAXPACKETSIZE; buf = mycalloc('r',1,bufsize); printf("send version myservices.%llu to (%s)\n",(long long)coin->myservices,addr->ipaddr); + //if ( addr->supernet != 0 ) + // iguana_send_supernet(coin,addr,"{\"agent\":\"SuperNET\",\"method\":\"getpeers\"}",0); iguana_send_version(coin,addr,coin->myservices); sleep(1+(rand()%5)); iguana_queue_send(coin,addr,0,serialized,"getaddr",0,0,0); @@ -982,17 +984,25 @@ void iguana_dedicatedloop(struct iguana_info *coin,struct iguana_peer *addr) } } } + if ( flag == 0 ) + { + if ( run++ > 1000 ) + { + //printf("sleep\n"); + usleep(100000); + } + else if ( addr->rank != 1 ) + usleep(coin->polltimeout*100 + 0*(rand() % (coin->polltimeout*100))); + else usleep(100 + coin->polltimeout*1000); + } else run >>= 2; } if ( flag != 0 ) run = 0; - else if ( flag == 0 ) + else if ( addr->supernet != 0 && time(NULL) > lastping+10 ) { - if ( addr->supernet != 0 && time(NULL) > lastping+10 ) - { - iguana_send_supernet(coin,addr,"{\"agent\":\"SuperNET\",\"method\":\"getpeers\"}",0); - lastping = (uint32_t)time(NULL); - } - } else run >>= 2; + iguana_send_supernet(coin,addr,"{\"agent\":\"SuperNET\",\"method\":\"getpeers\"}",0); + lastping = (uint32_t)time(NULL); + } if ( coin->isRT != 0 && addr->rank > coin->MAXPEERS && (rand() % 100) == 0 ) { printf("isRT and low rank.%d ",addr->rank); diff --git a/iguana/main.c b/iguana/main.c index 5b6625f84..4c2c73840 100644 --- a/iguana/main.c +++ b/iguana/main.c @@ -331,6 +331,7 @@ void iguana_main(void *arg) while ( 1 ) { flag = 0; + iguana_jsonQ(); if ( flag == 0 )//|| addr->rank >= (coin->peers.numranked>>1) ) { struct iguana_helper *ptr;