Browse Source

Test

etomic
jl777 7 years ago
parent
commit
a86474e0d5
  1. 8
      iguana/exchanges/LP_commands.c
  2. 18
      iguana/exchanges/LP_nativeDEX.c

8
iguana/exchanges/LP_commands.c

@ -550,8 +550,12 @@ bot_resume(botid)\n\
return(LP_notify_recv(argjson)); return(LP_notify_recv(argjson));
else if ( strcmp(method,"getpeers") == 0 ) else if ( strcmp(method,"getpeers") == 0 )
{ {
bits256 zero; memset(zero.bytes,0,sizeof(zero)); if ( IAMLP != 0 )
LP_reserved_msg(0,"","",zero,LP_peers()); {
printf("send peers list\n");
bits256 zero; memset(zero.bytes,0,sizeof(zero));
LP_reserved_msg(0,"","",zero,LP_peers());
}
retstr = clonestr("{\"result\":\"success\"}"); retstr = clonestr("{\"result\":\"success\"}");
} }
// end received response // end received response

18
iguana/exchanges/LP_nativeDEX.c

@ -597,14 +597,15 @@ void LP_coinsloop(void *_coins)
int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int32_t pubsock,char *pushaddr,uint16_t myport) int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int32_t pubsock,char *pushaddr,uint16_t myport)
{ {
static uint32_t counter,numpeers; static uint32_t counter;//,numpeers;
struct iguana_info *coin,*ctmp; char *origipaddr; struct LP_peerinfo *peer,*tmp; uint32_t now; int32_t needpings,height,nonz = 0; struct iguana_info *coin,*ctmp; char *origipaddr; int32_t height,nonz = 0;//struct LP_peerinfo *peer,*tmp; uint32_t now;
now = (uint32_t)time(NULL);
if ( (origipaddr= myipaddr) == 0 ) if ( (origipaddr= myipaddr) == 0 )
origipaddr = "127.0.0.1"; origipaddr = "127.0.0.1";
if ( mypeer == 0 ) if ( mypeer == 0 )
myipaddr = "127.0.0.1"; myipaddr = "127.0.0.1";
numpeers = LP_numpeers(); /*
now = (uint32_t)time(NULL);
numpeers = LP_numpeers();
needpings = 0; needpings = 0;
HASH_ITER(hh,LP_peerinfos,peer,tmp) HASH_ITER(hh,LP_peerinfos,peer,tmp)
{ {
@ -624,7 +625,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
if ( strcmp(peer->ipaddr,myipaddr) != 0 ) if ( strcmp(peer->ipaddr,myipaddr) != 0 )
{ {
nonz++; nonz++;
issue_LP_getpeers(peer->ipaddr,peer->port); //issue_LP_getpeers(peer->ipaddr,peer->port);
//LP_peersquery(mypeer,pubsock,peer->ipaddr,peer->port,myipaddr,myport); //LP_peersquery(mypeer,pubsock,peer->ipaddr,peer->port,myipaddr,myport);
//if ( peer->diduquery == 0 ) //if ( peer->diduquery == 0 )
// LP_peer_pricesquery(peer); // LP_peer_pricesquery(peer);
@ -633,7 +634,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
} }
peer->lastpeers = now; peer->lastpeers = now;
} }
/*if ( peer->needping != 0 ) if ( peer->needping != 0 )
{ {
peer->diduquery = now; peer->diduquery = now;
nonz++; nonz++;
@ -641,8 +642,8 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
free(retstr); free(retstr);
peer->needping = 0; peer->needping = 0;
needpings++; needpings++;
}*/ }
} }*/
HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht
{ {
if ( coin->addr_listunspent_requested != 0 && time(NULL) > coin->lastpushtime+LP_ORDERBOOK_DURATION ) if ( coin->addr_listunspent_requested != 0 && time(NULL) > coin->lastpushtime+LP_ORDERBOOK_DURATION )
@ -1092,6 +1093,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
printf("error launching LP_swapsloop for port.%u\n",myport); printf("error launching LP_swapsloop for port.%u\n",myport);
exit(-1); exit(-1);
} }
LP_reserved_msg(0,"","",G.LP_mypub25519,clonestr("{\"method\":\"getpeers\"}"));
int32_t nonz; //uint32_t lasthello = 0; int32_t nonz; //uint32_t lasthello = 0;
while ( 1 ) while ( 1 )
{ {

Loading…
Cancel
Save