gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated: setup_epoll_to_listen: do add ITC


From: gnunet
Subject: [libmicrohttpd] branch master updated: setup_epoll_to_listen: do add ITC when have no listen socket
Date: Thu, 08 Oct 2020 11:00:07 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new 558a5c86 setup_epoll_to_listen: do add ITC when have no listen socket
558a5c86 is described below

commit 558a5c86b2f3b485dd0c162fb3204c9c00810920
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu Oct 8 11:52:39 2020 +0300

    setup_epoll_to_listen: do add ITC when have no listen socket
---
 src/microhttpd/daemon.c | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 22b0a775..42c21b6c 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -5625,6 +5625,11 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
   struct epoll_event event;
   MHD_socket ls;
 
+  mhd_assert (0 != (daemon->options & MHD_USE_EPOLL));
+  mhd_assert (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION));
+  mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
+               (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) || \
+               MHD_ITC_IS_VALID_ (daemon->itc) );
   daemon->epoll_fd = setup_epoll_fd (daemon);
   if (-1 == daemon->epoll_fd)
     return MHD_NO;
@@ -5636,24 +5641,26 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
       return MHD_NO;
   }
 #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
-  if ( (MHD_INVALID_SOCKET == (ls = daemon->listen_fd)) ||
-       (daemon->was_quiesced) )
-    return MHD_YES; /* non-listening daemon */
-  event.events = EPOLLIN;
-  event.data.ptr = daemon;
-  if (0 != epoll_ctl (daemon->epoll_fd,
-                      EPOLL_CTL_ADD,
-                      ls,
-                      &event))
+  if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) &&
+       (! daemon->was_quiesced) )
   {
+    event.events = EPOLLIN;
+    event.data.ptr = daemon;
+    if (0 != epoll_ctl (daemon->epoll_fd,
+                        EPOLL_CTL_ADD,
+                        ls,
+                        &event))
+    {
 #ifdef HAVE_MESSAGES
-    MHD_DLOG (daemon,
-              _ ("Call to epoll_ctl failed: %s\n"),
-              MHD_socket_last_strerr_ ());
+      MHD_DLOG (daemon,
+                _ ("Call to epoll_ctl failed: %s\n"),
+                MHD_socket_last_strerr_ ());
 #endif
-    return MHD_NO;
+      return MHD_NO;
+    }
+    daemon->listen_socket_in_epoll = true;
   }
-  daemon->listen_socket_in_epoll = true;
+
   if (MHD_ITC_IS_VALID_ (daemon->itc))
   {
     event.events = EPOLLIN;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]