move SET_SOCKOPT_NOSIGPIPE from sockopt.c to sockopt.h
parent
ca5eefc8d2
commit
41db7d0bc2
3
HISTORY
3
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
|
||||
|
|
|
|||
|
|
@ -13,9 +13,6 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@
|
|||
|
||||
#include <net/if.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#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
|
||||
|
|
|
|||
Loading…
Reference in New Issue