[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 01/02: internal_add_connection: refuse blocking sockets
From: |
gnunet |
Subject: |
[libmicrohttpd] 01/02: internal_add_connection: refuse blocking sockets in epoll mode |
Date: |
Thu, 08 Oct 2020 15:39:32 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit e58fbba00a9439fc918d0ebd44f943818cb664f7
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu Oct 8 15:20:50 2020 +0300
internal_add_connection: refuse blocking sockets in epoll mode
---
src/microhttpd/daemon.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 42c21b6c..c5e51d37 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2404,9 +2404,8 @@ internal_add_connection (struct MHD_Daemon *daemon,
}
#endif
- if ( (! MHD_SCKT_FD_FITS_FDSET_ (client_socket,
- NULL)) &&
- (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL))) )
+ if ( (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL))) &&
+ (! MHD_SCKT_FD_FITS_FDSET_ (client_socket, NULL)) )
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
@@ -2415,6 +2414,20 @@ internal_add_connection (struct MHD_Daemon *daemon,
(int) FD_SETSIZE);
#endif
MHD_socket_close_chk_ (client_socket);
+#if ENFILE
+ errno = ENFILE;
+#endif
+ return MHD_NO;
+ }
+
+ if ( (0 == (daemon->options & MHD_USE_EPOLL)) &&
+ (! non_blck) )
+ {
+#ifdef HAVE_MESSAGES
+ MHD_DLOG (daemon,
+ _ ("Epoll mode supports only non-blocking sockets\n"));
+#endif
+ MHD_socket_close_chk_ (client_socket);
#if EINVAL
errno = EINVAL;
#endif
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.