listen: don't make the server socket non-blocking

There is no point in making the server socket non-blocking.  We call
accept() only after select() has notified us about a new connection.
This commit is contained in:
Max Kellermann 2008-12-30 19:18:59 +01:00
parent 6890183c50
commit 1f0804bdca
1 changed files with 1 additions and 7 deletions

View File

@ -67,11 +67,6 @@ static int establishListen(int pf, const struct sockaddr *addrp,
if ((sock = socket(pf, SOCK_STREAM, 0)) < 0)
g_error("socket < 0");
if (set_nonblocking(sock) < 0) {
g_error("problems setting nonblocking on listen socket: %s",
strerror(errno));
}
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&allowReuse,
sizeof(allowReuse)) < 0) {
g_error("problems setsockopt'ing: %s", strerror(errno));
@ -283,8 +278,7 @@ void getConnections(fd_set * fds)
if ((fd = accept(listenSockets[i], &sockAddr, &socklen))
>= 0) {
client_new(fd, &sockAddr, get_remote_uid(fd));
} else if (fd < 0
&& (errno != EAGAIN && errno != EINTR)) {
} else if (fd < 0 && errno != EINTR) {
g_warning("Problems accept()'ing");
}
}