jl777 7 years ago
parent
commit
c7531b8fbc
  1. 3
      iguana/exchanges/LP_commands.c
  2. 2
      iguana/exchanges/LP_include.h
  3. 20
      iguana/exchanges/LP_nativeDEX.c
  4. 1
      iguana/exchanges/LP_peers.c
  5. 2
      iguana/exchanges/stats.c

3
iguana/exchanges/LP_commands.c

@ -198,6 +198,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
return(clonestr("{\"error\":\"authentication error you need to make sure userpass is set\"}")); return(clonestr("{\"error\":\"authentication error you need to make sure userpass is set\"}"));
if ( jobj(argjson,"userpass") != 0 ) if ( jobj(argjson,"userpass") != 0 )
jdelete(argjson,"userpass"); jdelete(argjson,"userpass");
LP_cmdcount++;
if ( strcmp(method,"passphrase") == 0 ) if ( strcmp(method,"passphrase") == 0 )
{ {
char coinaddr[64],pub33str[67]; char coinaddr[64],pub33str[67];
@ -651,7 +652,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
else if ( strcmp(method,"notify") == 0 ) else if ( strcmp(method,"notify") == 0 )
return(LP_notify_recv(argjson)); return(LP_notify_recv(argjson));
else if ( strcmp(method,"getpeers") == 0 ) else if ( strcmp(method,"getpeers") == 0 )
retstr = clonestr("{\"error\":\"deprecated\"}"); return(LP_peers());
else if ( strcmp(method,"balances") == 0 ) else if ( strcmp(method,"balances") == 0 )
return(jprint(LP_balances(jstr(argjson,"address")),1)); return(jprint(LP_balances(jstr(argjson,"address")),1));
else if ( strcmp(method,"fundvalue") == 0 ) else if ( strcmp(method,"fundvalue") == 0 )

2
iguana/exchanges/LP_include.h

@ -363,7 +363,7 @@ struct LP_peerinfo
uint64_t ip_port; uint64_t ip_port;
uint32_t recvtime,numrecv,ipbits,errortime,errors,numpeers,needping,lasttime,connected,lastutxos,lastpeers,diduquery,good,sessionid; uint32_t recvtime,numrecv,ipbits,errortime,errors,numpeers,needping,lasttime,connected,lastutxos,lastpeers,diduquery,good,sessionid;
int32_t pushsock,subsock,isLP; int32_t pushsock,subsock,isLP;
uint16_t port; uint16_t port,netid;
char ipaddr[64]; char ipaddr[64];
}; };

20
iguana/exchanges/LP_nativeDEX.c

@ -102,7 +102,7 @@ uint16_t LP_fixed_pairport;//,LP_publicport;
uint32_t LP_lastnonce,LP_swap_endcritical,LP_swap_critical,LP_RTcount,LP_swapscount; uint32_t LP_lastnonce,LP_swap_endcritical,LP_swap_critical,LP_RTcount,LP_swapscount;
int32_t LP_STOP_RECEIVED,LP_numactive_LP;//,LP_mybussock = -1; int32_t LP_STOP_RECEIVED,LP_numactive_LP;//,LP_mybussock = -1;
int32_t LP_mypubsock = -1; int32_t LP_mypubsock = -1;
int32_t LP_mypullsock = -1; int32_t LP_cmdcount,LP_mypullsock = -1;
int32_t LP_numfinished,LP_showwif,IAMLP = 0; int32_t LP_numfinished,LP_showwif,IAMLP = 0;
double LP_profitratio = 1.; double LP_profitratio = 1.;
@ -1299,12 +1299,6 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
printf("error launching stats rpcloop for port.%u\n",myport); printf("error launching stats rpcloop for port.%u\n",myport);
exit(-1); exit(-1);
} }
uint16_t myport2 = myport-1;
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)stats_rpcloop,(void *)&myport2) != 0 )
{
printf("error launching stats rpcloop for port.%u\n",myport);
exit(-1);
}
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)command_rpcloop,ctx) != 0 ) if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)command_rpcloop,ctx) != 0 )
{ {
printf("error launching command_rpcloop for ctx.%p\n",ctx); printf("error launching command_rpcloop for ctx.%p\n",ctx);
@ -1355,7 +1349,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
printf("error launching LP_swapsloop for ctx.%p\n",ctx); printf("error launching LP_swapsloop for ctx.%p\n",ctx);
exit(-1); exit(-1);
} }
int32_t nonz; int32_t nonz,didremote=0;
LP_statslog_parse(); LP_statslog_parse();
bitcoind_RPC_inittime = 0; bitcoind_RPC_inittime = 0;
while ( LP_STOP_RECEIVED == 0 ) while ( LP_STOP_RECEIVED == 0 )
@ -1369,6 +1363,16 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
} }
if ( LP_mainloop_iter(ctx,myipaddr,mypeer,pubsock,pushaddr,myport) != 0 ) if ( LP_mainloop_iter(ctx,myipaddr,mypeer,pubsock,pushaddr,myport) != 0 )
nonz++; nonz++;
if ( didremote == 0 && LP_cmdcount > 0 )
{
didremote = 1;
uint16_t myport2 = myport-1;
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)stats_rpcloop,(void *)&myport2) != 0 )
{
printf("error launching stats rpcloop for port.%u\n",myport);
exit(-1);
}
}
if ( nonz == 0 ) if ( nonz == 0 )
usleep(1000); usleep(1000);
else if ( IAMLP == 0 ) else if ( IAMLP == 0 )

1
iguana/exchanges/LP_peers.c

@ -33,6 +33,7 @@ cJSON *LP_peerjson(struct LP_peerinfo *peer)
cJSON *item = cJSON_CreateObject(); cJSON *item = cJSON_CreateObject();
jaddstr(item,"isLP",peer->ipaddr); jaddstr(item,"isLP",peer->ipaddr);
jaddnum(item,"port",peer->port); jaddnum(item,"port",peer->port);
jaddnum(item,"netid",peer->netid);
if ( strcmp(peer->ipaddr,LP_myipaddr) == 0 ) if ( strcmp(peer->ipaddr,LP_myipaddr) == 0 )
{ {
jaddnum(item,"session",G.LP_sessionid); jaddnum(item,"session",G.LP_sessionid);

2
iguana/exchanges/stats.c

@ -819,7 +819,7 @@ void stats_rpcloop(void *args)
} }
#endif*/ #endif*/
memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits)); memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits));
printf("port.%u got incoming from %x\n",port,ipbits); //printf("port.%u got incoming from %x\n",port,ipbits);
if ( DOCKERFLAG != 0 && (DOCKERFLAG == 1 || ipbits == DOCKERFLAG) ) if ( DOCKERFLAG != 0 && (DOCKERFLAG == 1 || ipbits == DOCKERFLAG) )
ipbits = localhostbits; ipbits = localhostbits;
if ( port == RPC_port && ipbits != localhostbits ) if ( port == RPC_port && ipbits != localhostbits )

Loading…
Cancel
Save