Browse Source

Test

etomic
jl777 7 years ago
parent
commit
37eaf4b54b
  1. 12
      iguana/exchanges/LP_nativeDEX.c
  2. 9
      iguana/exchanges/stats.c

12
iguana/exchanges/LP_nativeDEX.c

@ -1190,18 +1190,24 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( (hellostr= jstr(retjson,"status")) != 0 && strcmp(hellostr,"") == 0 )
if ( (hellostr= jstr(retjson,"status")) != 0 && strcmp(hellostr,"got hello") == 0 )
allgood = 1, printf("allgood.(%s)\n",retstr);
else printf("strange return.(%s)\n",jprint(retjson,0));
free_json(retjson);
} else printf("couldnt parse hello return.(%s)\n",retstr);
free(retstr);
} else printf("issue_hello NULL return\n");
if ( 0 && allgood == 0 )
if ( allgood == 0 )
{
printf("RPC port got stuck, kick it\n");
printf("RPC port got stuck, start a new thread\n");
LP_bindsock = -1;
closesocket(sock);
LP_bindsock_reset++;
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)stats_rpcloop,(void *)&myport) != 0 )
{
printf("error launching stats rpcloop for port.%u\n",myport);
exit(-1);
}
}
}
}

9
iguana/exchanges/stats.c

@ -740,17 +740,17 @@ void LP_rpc_processreq(void *_ptr)
}
extern int32_t IAMLP;
int32_t LP_bindsock = -1;
int32_t LP_bindsock_reset,LP_bindsock = -1;
void stats_rpcloop(void *args)
{
static uint32_t counter;
uint16_t port; int32_t retval,sock; socklen_t clilen; struct sockaddr_in cli_addr; uint32_t ipbits,localhostbits; struct rpcrequest_info *req,*req2,*rtmp;
uint16_t port; int32_t retval,sock,initial_bindsock_reset; socklen_t clilen; struct sockaddr_in cli_addr; uint32_t ipbits,localhostbits,counter=0; struct rpcrequest_info *req,*req2,*rtmp;
if ( (port= *(uint16_t *)args) == 0 )
port = 7779;
RPC_port = port;
localhostbits = (uint32_t)calc_ipbits("127.0.0.1");
while ( 1 )
initial_bindsock_reset = LP_bindsock_reset;
while ( LP_bindsock_reset == initial_bindsock_reset )
{
//printf("LP_bindsock.%d\n",LP_bindsock);
if ( LP_bindsock < 0 )
@ -776,6 +776,7 @@ void stats_rpcloop(void *args)
req->ipbits = ipbits;
LP_rpc_processreq(req);
continue;
// this leads to cant open file errors
if ( (retval= OS_thread_create(&req->T,NULL,(void *)LP_rpc_processreq,req)) != 0 )
{
printf("error launching rpc handler on port %d, retval.%d\n",port,retval);

Loading…
Cancel
Save