Browse Source

Test

etomic
jl777 7 years ago
parent
commit
94514cd687
  1. 8
      iguana/exchanges/LP_forwarding.c
  2. 8
      iguana/exchanges/LP_nativeDEX.c

8
iguana/exchanges/LP_forwarding.c

@ -60,7 +60,7 @@ int32_t LP_hello(struct LP_forwardinfo *ptr)
if ( nn_poll(&pfd,1,1) > 0 )
{
sprintf(msg,"{\"method\":\"hello\",\"from\":\"%s\"}",LP_mypeer != 0 ? LP_mypeer->ipaddr : "");
printf("HELLO sent.%d bytes to %s on i.%d\n",LP_send(ptr->pushsock,msg,0),ptr->pushaddr,i);
//printf("HELLO sent.%d bytes to %s on i.%d\n",LP_send(ptr->pushsock,msg,0),ptr->pushaddr,i);
ptr->hello = (uint32_t)time(NULL);
return(i);
}
@ -120,8 +120,10 @@ char *LP_register(bits256 pubkey,char *ipaddr,uint16_t port)
{
nn_close(ptr->pushsock);
if ( LP_psockmark(ptr->pushaddr) < 0 )
printf("cant mark (%s)\n",ptr->pushaddr);
printf("recreate pushsock for %s\n",pushaddr);
{
//printf("cant mark (%s)\n",ptr->pushaddr);
}
char str[65]; printf("%u recreate pushsock for %s <- %s\n",(uint32_t)time(NULL),pushaddr,bits256_str(str,pubkey));
strcpy(ptr->pushaddr,pushaddr);
if ( (ptr->pushsock= LP_pushsock_create(ptr,pushaddr)) < 0 )
return(clonestr("{\"error\":\"couldnt recreate pushsock\",\"registered\":0}"));

8
iguana/exchanges/LP_nativeDEX.c

@ -397,7 +397,13 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,double profit
LP_profitratio += profitmargin;
OS_randombytes((void *)&n,sizeof(n));
if ( jobj(argjson,"canbind") == 0 )
{
#ifndef __linux__
LP_canbind = 1;
#else
LP_canbind = IAMLP;
#endif
}
else LP_canbind = jint(argjson,"canbind");
srand((int32_t)n);
if ( userhome != 0 && userhome[0] != 0 )
@ -470,7 +476,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,double profit
}
while ( 1 )
{
fprintf(stderr,".");
//fprintf(stderr,".");
if ( LP_mainloop_iter(ctx,myipaddr,mypeer,pubsock,pushaddr,mypullport,pullsock,myport,passphrase,profitmargin) == 0 )
usleep(100000);
if ( LP_canbind == 0 )

Loading…
Cancel
Save