From 807e83acf2af6b616907b0f4d0e1bf2d007dc70e Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 8 Nov 2017 01:29:44 +0200 Subject: [PATCH] Test --- iguana/exchanges/stats.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/iguana/exchanges/stats.c b/iguana/exchanges/stats.c index 9b6b47575..1a73926f8 100644 --- a/iguana/exchanges/stats.c +++ b/iguana/exchanges/stats.c @@ -23,10 +23,6 @@ #include #include -#include /* See NOTES */ -#define _GNU_SOURCE /* See feature_test_macros(7) */ -#include -int32_t accept4(int fildes, struct sockaddr *sock_addr, socklen_t *sock_addr_size, int flags); #include "../../crypto777/OS_portable.h" #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define STATS_DESTDIR "/var/www/html" @@ -761,26 +757,23 @@ void stats_rpcloop(void *args) { while ( (LP_bindsock= 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); +#endif //if ( counter++ < 1 ) printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,LP_bindsock); } //printf("after LP_bindsock.%d\n",LP_bindsock); clilen = sizeof(cli_addr); -#ifdef _WIN32 - sock = accept(LP_bindsock,(struct sockaddr *)&cli_addr,&clilen); -#else -#ifdef __APPLE__ sock = accept(LP_bindsock,(struct sockaddr *)&cli_addr,&clilen); -#else - sock = accept4(LP_bindsock,(struct sockaddr *)&cli_addr,&clilen,SOCK_NONBLOCK); +#ifdef _WIN32 if ( sock < 0 ) { fprintf(stderr,"."); usleep(50000); continue; } -#endif -#endif +#else if ( sock < 0 ) { printf("iguana_rpcloop ERROR on accept usock.%d errno %d %s\n",sock,errno,strerror(errno)); @@ -788,6 +781,7 @@ void stats_rpcloop(void *args) LP_bindsock = -1; continue; } +#endif memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits)); req = calloc(1,sizeof(*req)); req->sock = sock;