diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 86309dcd8..1b7f0a5bf 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -342,7 +342,7 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int free_json(recvjson); } } - int32_t validreq = 1; + int32_t validreq = 0; if ( strlen((char *)ptr)+sizeof(bits256) <= recvlen ) { if ( LP_magic_check(ptr,recvlen,remoteaddr) <= 0 ) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 9a546dd8d..1ae9fa023 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -25,6 +25,7 @@ char *LP_issue_curl(char *debugstr,char *destip,uint16_t port,char *url) maxerrs = LP_MAXPEER_ERRORS; if ( peer == 0 || (peer->errors < maxerrs || peer->good >= LP_MINPEER_GOOD) ) { + printf("issue.(%s)\n",url); if ( (retstr= issue_curlt(url,LP_HTTP_TIMEOUT)) == 0 ) { if ( peer != 0 ) diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index af730f70b..d62bbe407 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -732,29 +732,33 @@ void LP_rpc_processreq(void *_ptr) void stats_rpcloop(void *args) { - uint16_t port; int32_t sock,bindsock; socklen_t clilen; struct sockaddr_in cli_addr; uint32_t ipbits; uint64_t arg64; void *arg64ptr; + uint16_t port; int32_t sock,bindsock=-1; socklen_t clilen; struct sockaddr_in cli_addr; uint32_t ipbits; uint64_t arg64; void *arg64ptr; if ( (port= *(uint16_t *)args) == 0 ) port = 7779; RPC_port = port; - while ( (bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 ) + /*while ( (bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 ) { //if ( coin->MAXPEERS == 1 ) // break; //exit(-1); sleep(3); } - printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,bindsock); - while ( bindsock >= 0 ) + printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,bindsock);*/ + while ( 1 ) { + if ( bindsock < 0 ) + { + while ( (bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 ) + sleep(3); + printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,bindsock); + } clilen = sizeof(cli_addr); sock = accept(bindsock,(struct sockaddr *)&cli_addr,&clilen); if ( sock < 0 ) { printf("iguana_rpcloop ERROR on accept usock.%d errno %d %s\n",sock,errno,strerror(errno)); close(bindsock); - while ( (bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 ) - sleep(3); - printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,bindsock); + bindsock = -1; continue; } memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits)); @@ -773,8 +777,10 @@ void stats_rpcloop(void *args) else if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_rpc_processreq,arg64ptr) != 0 ) { printf("error launching rpc handler on port %d\n",port); + // yes, small leak per command } - // yes, small leak per command + close(bindsock); + bindsock = -1; } }