diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/socket.c | 6 | ||||
-rw-r--r-- | src/common/socket.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/common/socket.c b/src/common/socket.c index 0f5b53550..729f2fdfe 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -62,6 +62,10 @@ void set_defaultparse(int (*defaultparse)(int)) default_func_parse = defaultparse; } +void set_nonblocking(int fd, int yes) { + setsockopt(fd,IPPROTO_TCP,TCP_NODELAY,(char *)&yes,sizeof yes); +} + static void setsocketopts(int fd) { int yes = 1; // reuse fix @@ -70,7 +74,7 @@ static void setsocketopts(int fd) #ifdef SO_REUSEPORT setsockopt(fd,SOL_SOCKET,SO_REUSEPORT,(char *)&yes,sizeof yes); #endif - setsockopt(fd,IPPROTO_TCP,TCP_NODELAY,(char *)&yes,sizeof yes); + set_nonblocking(fd, yes); setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *) &wfifo_size , sizeof(rfifo_size )); setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *) &rfifo_size , sizeof(rfifo_size )); diff --git a/src/common/socket.h b/src/common/socket.h index 43acd6941..9b0c05013 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -91,6 +91,7 @@ int do_parsepacket(void); void do_socket(void); extern void flush_fifos(); +extern void set_nonblocking(int fd, int yes); int start_console(void); |