From 1ee4dbc6b2c209689d7286dd15b58bbdb9bd48b8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 5 Jun 2017 22:47:03 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_nativeDEX.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index cead54feb..0ca6db3b0 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -181,7 +181,7 @@ struct LP_peerinfo UT_hash_handle hh; uint64_t ip_port; double profitmargin; - uint32_t ipbits,errortime,errors,numpeers,numutxos,lasttime,connected,lastutxos; + uint32_t ipbits,errortime,errors,numpeers,numutxos,lasttime,connected,lastutxos,lastpeers; int32_t pushsock,subsock; uint16_t port; char ipaddr[64]; diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 1d22abaa1..93959eab3 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -183,8 +183,9 @@ void LP_mainloop(struct LP_peerinfo *mypeer,uint16_t mypubport,int32_t pubsock,i now = (uint32_t)time(NULL); HASH_ITER(hh,LP_peerinfos,peer,tmp) { - if ( peer->numpeers > 0 && (peer->numpeers != mypeer->numpeers || (rand() % 10000) == 0) ) + if ( now > peer->lastpeers+60 && peer->numpeers > 0 && (peer->numpeers != mypeer->numpeers || (rand() % 10000) == 0) ) { + peer->lastpeers = now; if ( peer->numpeers != mypeer->numpeers ) printf("%s num.%d vs %d\n",peer->ipaddr,peer->numpeers,mypeer->numpeers); if ( strcmp(peer->ipaddr,mypeer->ipaddr) != 0 )