Remove mud_set_nonblock()

This commit is contained in:
Adrien Gallouët
2016-11-24 11:49:49 +00:00
parent ca9aa34ae3
commit 672e2ba2b5

15
mud.c
View File

@@ -9,7 +9,6 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h>
#include <time.h> #include <time.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/socket.h> #include <sys/socket.h>
@@ -316,17 +315,6 @@ ssize_t mud_send_path (struct mud *mud, struct path *path, uint64_t now,
return ret; return ret;
} }
static
int mud_set_nonblock (int fd)
{
int flags = fcntl(fd, F_GETFL, 0);
if (flags == -1)
flags = 0;
return fcntl(fd, F_SETFL, flags|O_NONBLOCK);
}
static static
int mud_sso_int (int fd, int level, int optname, int opt) int mud_sso_int (int fd, int level, int optname, int opt)
{ {
@@ -613,8 +601,7 @@ int mud_setup_socket (int fd, int v4, int v6)
if ((mud_sso_int(fd, SOL_SOCKET, SO_REUSEADDR, 1)) || if ((mud_sso_int(fd, SOL_SOCKET, SO_REUSEADDR, 1)) ||
(v4 && mud_sso_int(fd, IPPROTO_IP, MUD_PKTINFO, 1)) || (v4 && mud_sso_int(fd, IPPROTO_IP, MUD_PKTINFO, 1)) ||
(v6 && mud_sso_int(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, 1)) || (v6 && mud_sso_int(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, 1)) ||
(v6 && mud_sso_int(fd, IPPROTO_IPV6, IPV6_V6ONLY, !v4)) || (v6 && mud_sso_int(fd, IPPROTO_IPV6, IPV6_V6ONLY, !v4)))
(mud_set_nonblock(fd)))
return -1; return -1;
#ifdef __linux__ #ifdef __linux__