Browse Source

Test

etomic
jl777 8 years ago
parent
commit
d458b327d4
  1. 15
      iguana/exchanges/LP_nativeDEX.c

15
iguana/exchanges/LP_nativeDEX.c

@ -298,6 +298,13 @@ int32_t LP_mainloop_iter(char *myipaddr,struct LP_peerinfo *mypeer,int32_t pubso
free(retstr); free(retstr);
if ( IAMLP != 0 && (counter % 600) == 42 ) if ( IAMLP != 0 && (counter % 600) == 42 )
LP_hellos(); LP_hellos();
if ( LP_canbind == 0 && (counter % 60) == 13 )
{
char keepalive[128];
sprintf(keepalive,"{\"method\":\"keepalive\"}");
LP_send(pullsock,keepalive,0);
printf("send keepalive\n");
}
counter++; counter++;
return(nonz); return(nonz);
} }
@ -367,7 +374,7 @@ void LP_initpeers(int32_t pubsock,struct LP_peerinfo *mypeer,char *myipaddr,uint
void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,double profitmargin,char *passphrase,int32_t amclient,char *userhome,cJSON *argjson) void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,double profitmargin,char *passphrase,int32_t amclient,char *userhome,cJSON *argjson)
{ {
char *myipaddr=0; long filesize,n; int32_t timeout,pullsock=-1,pubsock=-1; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128],keepalive[128]; char *myipaddr=0; long filesize,n; int32_t timeout,pullsock=-1,pubsock=-1; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128];
IAMLP = !amclient; IAMLP = !amclient;
#ifndef __linux__ #ifndef __linux__
if ( IAMLP != 0 ) if ( IAMLP != 0 )
@ -467,12 +474,6 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,double profit
LP_deadman_switch = (uint32_t)time(NULL); LP_deadman_switch = (uint32_t)time(NULL);
LP_forwarding_register(LP_mypubkey,pushaddr,mypullport,100000); LP_forwarding_register(LP_mypubkey,pushaddr,mypullport,100000);
} }
else if ( LP_deadman_switch < time(NULL)-PSOCK_KEEPALIVE/2 )
{
sprintf(keepalive,"{\"method\":\"keepalive\"}");
LP_send(pullsock,keepalive,0);
printf("send keepalive\n");
}
} }
} }
} }

Loading…
Cancel
Save