Browse Source

Test

etomic
jl777 8 years ago
parent
commit
db86f30637
  1. 24
      iguana/exchanges/LP_nativeDEX.c

24
iguana/exchanges/LP_nativeDEX.c

@ -164,7 +164,6 @@ int32_t LP_pullsock_check(char **retstrp,char *myipaddr,int32_t pubsock,int32_t
{
nonz++;
*retstrp = LP_process_message("PULL",myipaddr,pubsock,profitmargin,ptr,recvlen,pullsock);
printf("got retstr.%p\n",*retstrp);
}
}
return(nonz);
@ -239,7 +238,7 @@ int32_t LP_mainloop_iter(char *myipaddr,struct LP_peerinfo *mypeer,int32_t pubso
origipaddr = "127.0.0.1";
if ( mypeer == 0 )
myipaddr = "127.0.0.1";
if ( LP_canbind == 0 ) printf("counter.%d canbind.%d peers\n",counter,LP_canbind);
//if ( LP_canbind == 0 ) printf("counter.%d canbind.%d peers\n",counter,LP_canbind);
numpeers = 0;
HASH_ITER(hh,LP_peerinfos,peer,tmp)
{
@ -268,7 +267,7 @@ int32_t LP_mainloop_iter(char *myipaddr,struct LP_peerinfo *mypeer,int32_t pubso
}
nonz += LP_subsock_check(origipaddr,pubsock,peer->subsock,profitmargin);
}
if ( LP_canbind == 0 ) printf("counter.%d canbind.%d forwarding\n",counter,LP_canbind);
//if ( LP_canbind == 0 ) printf("counter.%d canbind.%d forwarding\n",counter,LP_canbind);
if ( (counter % 600) == 60 )
{
LP_myutxo_updates(pubsock,passphrase,profitmargin);
@ -278,7 +277,7 @@ int32_t LP_mainloop_iter(char *myipaddr,struct LP_peerinfo *mypeer,int32_t pubso
lastforward = now;
}
}
if ( LP_canbind == 0 ) printf("counter.%d canbind.%d utxos\n",counter,LP_canbind);
//if ( LP_canbind == 0 ) printf("counter.%d canbind.%d utxos\n",counter,LP_canbind);
if ( (counter % 600) == 0 )
{
HASH_ITER(hh,LP_utxoinfos[0],utxo,utmp)
@ -292,7 +291,7 @@ int32_t LP_mainloop_iter(char *myipaddr,struct LP_peerinfo *mypeer,int32_t pubso
LP_utxo_clientpublish(utxo);
}
}
if ( LP_canbind == 0 ) printf("counter.%d canbind.%d swapentry\n",counter,LP_canbind);
//if ( LP_canbind == 0 ) printf("counter.%d canbind.%d swapentry\n",counter,LP_canbind);
if ( (counter % 600) == 599 )
{
if ( (retstr= basilisk_swapentry(0,0)) != 0 )
@ -301,25 +300,20 @@ int32_t LP_mainloop_iter(char *myipaddr,struct LP_peerinfo *mypeer,int32_t pubso
free(retstr);
}
}
if ( LP_canbind == 0 ) printf("counter.%d canbind.%d pullsock check\n",counter,LP_canbind);
//if ( LP_canbind == 0 ) printf("counter.%d canbind.%d pullsock check\n",counter,LP_canbind);
nonz += LP_pullsock_check(&retstr,myipaddr,pubsock,pullsock,profitmargin);
if ( retstr != 0 )
{
printf("free (%s)\n",retstr);
free(retstr);
printf("Freed\n");
}
if ( LP_canbind == 0 ) printf("counter.%d canbind.%d hellos\n",counter,LP_canbind);
//if ( LP_canbind == 0 ) printf("counter.%d canbind.%d hellos\n",counter,LP_canbind);
if ( IAMLP != 0 && (counter % 600) == 42 )
LP_hellos();
if ( LP_canbind == 0 ) printf("counter.%d canbind.%d\n",counter,LP_canbind);
//if ( LP_canbind == 0 ) printf("counter.%d canbind.%d\n",counter,LP_canbind);
if ( LP_canbind == 0 && (counter % 60) == 13 )
{
char keepalive[128];
sprintf(keepalive,"{\"method\":\"keepalive\"}");
printf("send keepalive\n");
LP_send(pullsock,keepalive,0);
printf("sent keepalive\n");
}
counter++;
return(nonz);
@ -475,13 +469,11 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,double profit
}
while ( 1 )
{
if ( LP_canbind == 0 )
printf("mainloop\n");
if ( LP_mainloop_iter(myipaddr,mypeer,pubsock,pushaddr,mypullport,pullsock,myport,passphrase,profitmargin) == 0 )
usleep(100000);
if ( LP_canbind == 0 )
{
printf("check deadman %u vs %u\n",LP_deadman_switch,(uint32_t)time(NULL));
//printf("check deadman %u vs %u\n",LP_deadman_switch,(uint32_t)time(NULL));
if ( LP_deadman_switch < time(NULL)-PSOCK_KEEPALIVE )
{
printf("DEAD man's switch activated, register forwarding again\n");

Loading…
Cancel
Save