Browse Source

Test

etomic
jl777 8 years ago
parent
commit
0da65da7b0
  1. 6
      iguana/exchanges/LP_nativeDEX.c
  2. 8
      iguana/exchanges/stats.c

6
iguana/exchanges/LP_nativeDEX.c

@ -1179,6 +1179,12 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
usleep(1000); usleep(1000);
else if ( IAMLP == 0 ) else if ( IAMLP == 0 )
usleep(1000); usleep(1000);
if ( (rand() % 10000) == 0 )
{
printf("rpc port reset test\n");
closesocket(LP_bindsock);
LP_bindsock = -1;
}
} }
#endif #endif
} }

8
iguana/exchanges/stats.c

@ -743,7 +743,7 @@ extern int32_t IAMLP;
int32_t LP_bindsock = -1; int32_t LP_bindsock = -1;
void stats_rpcloop(void *args) void stats_rpcloop(void *args)
{ {
static uint32_t counter; //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; socklen_t clilen; struct sockaddr_in cli_addr; uint32_t ipbits,localhostbits; struct rpcrequest_info *req,*req2,*rtmp;
if ( (port= *(uint16_t *)args) == 0 ) if ( (port= *(uint16_t *)args) == 0 )
port = 7779; port = 7779;
@ -755,7 +755,7 @@ void stats_rpcloop(void *args)
{ {
while ( (LP_bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 ) while ( (LP_bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 )
usleep(10000); usleep(10000);
if ( counter++ < 1 ) //if ( counter++ < 1 )
printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,LP_bindsock); printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,LP_bindsock);
} }
clilen = sizeof(cli_addr); clilen = sizeof(cli_addr);
@ -763,7 +763,7 @@ void stats_rpcloop(void *args)
if ( sock < 0 ) if ( sock < 0 )
{ {
printf("iguana_rpcloop ERROR on accept usock.%d errno %d %s\n",sock,errno,strerror(errno)); printf("iguana_rpcloop ERROR on accept usock.%d errno %d %s\n",sock,errno,strerror(errno));
close(LP_bindsock); closesocket(LP_bindsock);
LP_bindsock = -1; LP_bindsock = -1;
continue; continue;
} }
@ -776,7 +776,7 @@ continue;
if ( (retval= OS_thread_create(&req->T,NULL,(void *)LP_rpc_processreq,req)) != 0 ) 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); printf("error launching rpc handler on port %d, retval.%d\n",port,retval);
close(LP_bindsock); closesocket(LP_bindsock);
LP_bindsock = -1; LP_bindsock = -1;
portable_mutex_lock(&LP_gcmutex); portable_mutex_lock(&LP_gcmutex);
DL_FOREACH_SAFE(LP_garbage_collector,req2,rtmp) DL_FOREACH_SAFE(LP_garbage_collector,req2,rtmp)

Loading…
Cancel
Save