|
|
@ -740,38 +740,39 @@ void LP_rpc_processreq(void *_ptr) |
|
|
|
} |
|
|
|
|
|
|
|
extern int32_t IAMLP; |
|
|
|
int32_t LP_bindsock_reset,LP_bindsock = -1; |
|
|
|
//int32_t LP_bindsock_reset,LP_bindsock = -1;
|
|
|
|
|
|
|
|
void stats_rpcloop(void *args) |
|
|
|
{ |
|
|
|
uint16_t port; int32_t retval,sock,initial_bindsock_reset; 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=-1; socklen_t clilen; struct sockaddr_in cli_addr; uint32_t ipbits,localhostbits; struct rpcrequest_info *req,*req2,*rtmp; |
|
|
|
if ( (port= *(uint16_t *)args) == 0 ) |
|
|
|
port = 7779; |
|
|
|
RPC_port = port; |
|
|
|
printf("Start stats_rpcloop.%u\n",port); |
|
|
|
localhostbits = (uint32_t)calc_ipbits("127.0.0.1"); |
|
|
|
initial_bindsock_reset = LP_bindsock_reset; |
|
|
|
while ( LP_bindsock_reset == initial_bindsock_reset ) |
|
|
|
//initial_bindsock_reset = LP_bindsock_reset;
|
|
|
|
while ( 1 )//LP_bindsock_reset == initial_bindsock_reset )
|
|
|
|
{ |
|
|
|
//printf("LP_bindsock.%d\n",LP_bindsock);
|
|
|
|
if ( LP_bindsock < 0 ) |
|
|
|
if ( sock < 0 ) |
|
|
|
{ |
|
|
|
while ( (LP_bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 ) |
|
|
|
while ( (sock= iguana_socket(1,"0.0.0.0",port)) < 0 ) |
|
|
|
usleep(10000); |
|
|
|
#ifndef _WIN32 |
|
|
|
//fcntl(LP_bindsock, F_SETFL, fcntl(LP_bindsock, F_GETFL, 0) | O_NONBLOCK);
|
|
|
|
//fcntl(sock, F_SETFL, fcntl(sock, F_GETFL, 0) | O_NONBLOCK);
|
|
|
|
#endif |
|
|
|
//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,sock); |
|
|
|
} |
|
|
|
//printf("after LP_bindsock.%d\n",LP_bindsock);
|
|
|
|
//printf("after sock.%d\n",sock);
|
|
|
|
clilen = sizeof(cli_addr); |
|
|
|
sock = accept(LP_bindsock,(struct sockaddr *)&cli_addr,&clilen); |
|
|
|
sock = accept(sock,(struct sockaddr *)&cli_addr,&clilen); |
|
|
|
//#ifdef _WIN32
|
|
|
|
if ( sock < 0 ) |
|
|
|
{ |
|
|
|
printf("iguana_rpcloop ERROR on accept usock.%d errno %d %s\n",sock,errno,strerror(errno)); |
|
|
|
closesocket(LP_bindsock); |
|
|
|
LP_bindsock = -1; |
|
|
|
closesocket(sock); |
|
|
|
sock = -1; |
|
|
|
continue; |
|
|
|
} |
|
|
|
/*#else
|
|
|
@ -794,8 +795,8 @@ continue; |
|
|
|
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); |
|
|
|
closesocket(LP_bindsock); |
|
|
|
LP_bindsock = -1; |
|
|
|
closesocket(sock); |
|
|
|
sock = -1; |
|
|
|
portable_mutex_lock(&LP_gcmutex); |
|
|
|
DL_FOREACH_SAFE(LP_garbage_collector,req2,rtmp) |
|
|
|
{ |
|
|
|