Browse Source

Test

etomic
jl777 7 years ago
parent
commit
76b05f86e6
  1. 6
      iguana/exchanges/LP_include.h
  2. 4
      iguana/exchanges/LP_nativeDEX.c
  3. 4
      iguana/exchanges/LP_network.c

6
iguana/exchanges/LP_include.h

@ -24,6 +24,12 @@
#define LP_COMMAND_SENDSOCK NN_PUSH #define LP_COMMAND_SENDSOCK NN_PUSH
#define LP_COMMAND_RECVSOCK NN_PULL #define LP_COMMAND_RECVSOCK NN_PULL
#define PSOCK_KEEPALIVE 600
#define MAINLOOP_PERSEC 10
#define MAX_PSOCK_PORT 60000
#define MIN_PSOCK_PORT 10000
#define LP_HTTP_TIMEOUT 3 #define LP_HTTP_TIMEOUT 3
#define LP_MAXPEER_ERRORS 3 #define LP_MAXPEER_ERRORS 3
#define LP_SWAPSTEP_TIMEOUT 3 #define LP_SWAPSTEP_TIMEOUT 3

4
iguana/exchanges/LP_nativeDEX.c

@ -308,7 +308,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
if ( IAMLP != 0 && (counter % 600) == 42 ) if ( IAMLP != 0 && (counter % 600) == 42 )
LP_hellos(); 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 ) if ( LP_canbind == 0 && (counter % (PSOCK_KEEPALIVE*MAINLOOP_PERSEC/2)) == 13 )
{ {
char keepalive[128]; char keepalive[128];
sprintf(keepalive,"{\"method\":\"keepalive\"}"); sprintf(keepalive,"{\"method\":\"keepalive\"}");
@ -480,7 +480,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,double profit
{ {
//fprintf(stderr,"."); //fprintf(stderr,".");
if ( LP_mainloop_iter(ctx,myipaddr,mypeer,pubsock,pushaddr,mypullport,pullsock,myport,passphrase,profitmargin) == 0 ) if ( LP_mainloop_iter(ctx,myipaddr,mypeer,pubsock,pushaddr,mypullport,pullsock,myport,passphrase,profitmargin) == 0 )
usleep(100000); usleep(1000000 / MAINLOOP_PERSEC);
if ( LP_canbind == 0 ) 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));

4
iguana/exchanges/LP_network.c

@ -18,10 +18,6 @@
// marketmaker // marketmaker
// //
#define PSOCK_KEEPALIVE 600
#define MAX_PSOCK_PORT 60000
#define MIN_PSOCK_PORT 10000
struct psock struct psock
{ {
uint32_t lasttime,lastping,errors; uint32_t lasttime,lastping,errors;

Loading…
Cancel
Save