diff --git a/HISTORY b/HISTORY index dfee4d0..dfd11a9 100644 --- a/HISTORY +++ b/HISTORY @@ -1,4 +1,7 @@ +Version 1.31 2016-11-10 + * move SET_SOCKOPT_NOSIGPIPE from sockopt.c to sockopt.h + Version 1.30 2016-10-31 * modify php-fastcommon/test.php * php7_ext_wrapper.h: fix memory leak in php 7 diff --git a/src/sockopt.c b/src/sockopt.c index 1cfe02f..5ac6de9 100644 --- a/src/sockopt.c +++ b/src/sockopt.c @@ -13,9 +13,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -871,16 +868,6 @@ int socketBind(int sock, const char *bind_ipaddr, const int port) return 0; } -#ifdef SO_NOSIGPIPE -#define SET_SOCKOPT_NOSIGPIPE(sock) \ - do { \ - int set = 1; \ - setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(int)); \ - } while (0) -#else -#define SET_SOCKOPT_NOSIGPIPE(sock) -#endif - int socketServer(const char *bind_ipaddr, const int port, int *err_no) { int sock; diff --git a/src/sockopt.h b/src/sockopt.h index 8306094..9918a2a 100644 --- a/src/sockopt.h +++ b/src/sockopt.h @@ -13,6 +13,9 @@ #include #include +#include +#include +#include #include "common_define.h" #define FAST_WRITE_BUFF_SIZE 256 * 1024 @@ -29,6 +32,16 @@ typedef struct ip_addr_s { int socket_domain; } ip_addr_t; +#ifdef SO_NOSIGPIPE +#define SET_SOCKOPT_NOSIGPIPE(sock) \ + do { \ + int set = 1; \ + setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(int)); \ + } while (0) +#else +#define SET_SOCKOPT_NOSIGPIPE(sock) +#endif + #ifdef __cplusplus extern "C" { #endif