gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r33157 - in libmicrohttpd: . src/microhttpd


From: gnunet
Subject: [GNUnet-SVN] r33157 - in libmicrohttpd: . src/microhttpd
Date: Fri, 2 May 2014 20:37:35 +0200

Author: grothoff
Date: 2014-05-02 20:37:35 +0200 (Fri, 02 May 2014)
New Revision: 33157

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/microhttpd/daemon.c
Log:
fix rare epoll/resume issue, also simplifying logic

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2014-05-02 18:23:58 UTC (rev 33156)
+++ libmicrohttpd/ChangeLog     2014-05-02 18:37:35 UTC (rev 33157)
@@ -1,5 +1,8 @@
 May  2 20:22:45 CEST 2014
        Fix infinite loop (DoS) when HTTP connection is reset (#3392). -GM
+       Fix possible issue from combination of epoll and suspend/resume
+       logic if edge trigger event is lost; also simplify logic to
+       maintain simpler invariants on the epoll state. -CG
 
 Thu Apr 10 09:39:38 CEST 2014
        Removed unescaping for URI path (#3371) as '+' should not

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2014-05-02 18:23:58 UTC (rev 
33156)
+++ libmicrohttpd/src/microhttpd/daemon.c       2014-05-02 18:37:35 UTC (rev 
33157)
@@ -1535,6 +1535,7 @@
           EDLL_remove (daemon->eready_head,
                        daemon->eready_tail,
                        connection);
+          connection->epoll_state &= ~MHD_EPOLL_STATE_IN_EREADY_EDLL;
         }
       if (0 != (connection->epoll_state & MHD_EPOLL_STATE_IN_EPOLL_SET))
         {
@@ -1633,25 +1634,13 @@
       if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY))
         {
           if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL))
-            {
-              EDLL_insert (daemon->eready_head,
-                           daemon->eready_tail,
-                           pos);
-            }
-          else
-            {
-              struct epoll_event event;
-
-              event.events = EPOLLIN | EPOLLOUT | EPOLLET;
-              event.data.ptr = pos;
-              if (0 != epoll_ctl (daemon->epoll_fd,
-                                  EPOLL_CTL_ADD,
-                                  pos->socket_fd,
-                                  &event))
-                MHD_PANIC ("Failed to add FD to epoll set\n");
-              else
-                pos->epoll_state |= MHD_EPOLL_STATE_IN_EPOLL_SET;
-            }
+            MHD_PANIC ("Resumed connection was already in EREADY set\n");
+          /* we always mark resumed connections as ready, as we
+             might have missed the edge poll event during suspension */
+          EDLL_insert (daemon->eready_head,
+                       daemon->eready_tail,
+                       pos);
+          pos->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL;
           pos->epoll_state &= ~MHD_EPOLL_STATE_SUSPENDED;
         }
 #endif
@@ -2981,7 +2970,7 @@
         case MHD_OPTION_HTTPS_MEM_DHPARAMS:
           if (0 != (daemon->options & MHD_USE_SSL))
             {
-              const char *arg = va_arg (ap, const unsigned char *);
+              const char *arg = va_arg (ap, const char *);
               gnutls_datum_t dhpar;
 
               if (gnutls_dh_params_init (&daemon->https_mem_dhparams) < 0)




reply via email to

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