Browse Source

Test

etomic
jl777 8 years ago
parent
commit
3e94d30bc4
  1. 6
      iguana/exchanges/LP_unspents.c

6
iguana/exchanges/LP_unspents.c

@ -13,7 +13,7 @@ char *default_LPnodes[] = { "5.9.253.195", "5.9.253.196", "5.9.253.197", "5.9.25
struct LP_peerinfo struct LP_peerinfo
{ {
double profitmargin; double profitmargin;
uint32_t ipbits,gotintro,sentintro; uint32_t ipbits,gotintro,sentintro,errortime,errors;
char ipaddr[64],notify_ipaddr[64]; char ipaddr[64],notify_ipaddr[64];
uint16_t port,notify_port; uint16_t port,notify_port;
} LP_peerinfos[1024]; } LP_peerinfos[1024];
@ -282,14 +282,14 @@ void LPinit(uint16_t port,double profitmargin)
if ( LP_numpeers > 0 ) if ( LP_numpeers > 0 )
{ {
i = rand() % LP_numpeers; i = rand() % LP_numpeers;
if ( i > 0 ) if ( i > 0 && (peer->errors == 0 || (time(NULL) - peer->errortime) > 3600) )
{ {
peer = &LP_peerinfos[i]; peer = &LP_peerinfos[i];
if ( (retstr= issue_LP_getpeers(peer->ipaddr,peer->port,LP_peerinfos[0].ipaddr,LP_peerinfos[0].port,LP_peerinfos[0].profitmargin)) != 0 ) if ( (retstr= issue_LP_getpeers(peer->ipaddr,peer->port,LP_peerinfos[0].ipaddr,LP_peerinfos[0].port,LP_peerinfos[0].profitmargin)) != 0 )
{ {
LP_notify(&LP_peerinfos[0],peer->ipaddr,peer->port,retstr); LP_notify(&LP_peerinfos[0],peer->ipaddr,peer->port,retstr);
//free(retstr); //free(retstr);
} } else peer->errors++, peer->errortime = (uint32_t)time(NULL);
} }
} }
sleep(60); sleep(60);

Loading…
Cancel
Save