[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] PATCH: Fix check for epoll mode and blocking socket
From: |
Kolja Nowak |
Subject: |
[libmicrohttpd] PATCH: Fix check for epoll mode and blocking socket |
Date: |
Tue, 17 May 2022 08:07:34 +0000 |
Hi,
I'm trying to use libmicrohttpd on a platform where fcntl(fd, O_NONBLOCK)
doesn't work for sockets. This shouldn't be a problem, as far as I understand,
except in epoll mode, which I'm not using, because epoll() isn't available
either.
However, there is a check in daemon.c:internal_add_connection(), the purpose of
which seems to be to prevent using a blocking socket in epoll mode. At least
that's what the debug message says. The code however does the opposite, it
prevents the use of a blocking socket if epoll mode is *not* used. This was
probably never noticed because platforms without non-blocking sockets are rare.
Please consider applying the following simple fix:
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 64524b1b..8308e6ef 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2983,11 +2983,11 @@ internal_add_connection (struct MHD_Daemon *daemon,
errno = ENFILE;
#endif
return MHD_NO;
}
- if ( (0 == (daemon->options & MHD_USE_EPOLL)) &&
+ if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
(! non_blck) )
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
_ ("Epoll mode supports only non-blocking sockets\n"));
--
Greetings,
Kolja Nowak.
- [libmicrohttpd] PATCH: Fix check for epoll mode and blocking socket,
Kolja Nowak <=