diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index 2d93e296e..c58a6f0ca 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -763,8 +763,6 @@ void stats_rpcloop(void *args) bindsock = -1; continue; } - close(bindsock); - bindsock = iguana_socket(1,"0.0.0.0",port); memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits)); arg64 = ((uint64_t)ipbits << 32) | (sock & 0xffffffff); arg64ptr = malloc(sizeof(arg64)); @@ -783,6 +781,8 @@ void stats_rpcloop(void *args) printf("error launching rpc handler on port %d\n",port); // yes, small leak per command } + close(bindsock); + bindsock = iguana_socket(1,"0.0.0.0",port); } }