gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated: mark 'was_closed' as


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated: mark 'was_closed' as volatile; move connection resumption to end of upgrade routine to avoid race issue; eliminate dead code
Date: Tue, 14 Feb 2017 17:07:47 +0100

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

grothoff pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new 8a84902f mark 'was_closed' as volatile; move connection resumption to 
end of upgrade routine to avoid race issue; eliminate dead code
8a84902f is described below

commit 8a84902f7447edd6f677dfa9983c16146dacc7c5
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Feb 14 17:08:40 2017 +0100

    mark 'was_closed' as volatile; move connection resumption to end of upgrade 
routine to avoid race issue; eliminate dead code
---
 src/microhttpd/daemon.c   | 27 ---------------------------
 src/microhttpd/internal.h |  2 +-
 src/microhttpd/response.c | 14 +++++++-------
 3 files changed, 8 insertions(+), 35 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 97fcc813..fda7f51b 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -5696,33 +5696,6 @@ close_all_connections (struct MHD_Daemon *daemon)
 }
 
 
-#ifdef EPOLL_SUPPORT
-/**
- * Shutdown epoll()-event loop by adding write end of 'itc' to its event set.
- *
- * @param daemon daemon of which the epoll() instance must be signalled
- */
-static void
-epoll_shutdown (struct MHD_Daemon *daemon)
-{
-  struct epoll_event event;
-
-  if (MHD_ITC_IS_INVALID_(daemon->itc))
-    {
-      /* itc was required in this mode, how could this happen? */
-      MHD_PANIC (_("Internal error\n"));
-    }
-  event.events = EPOLLOUT;
-  event.data.ptr = NULL;
-  if (0 != epoll_ctl (daemon->epoll_fd,
-                     EPOLL_CTL_ADD,
-                     MHD_itc_w_fd_ (daemon->itc),
-                     &event))
-    MHD_PANIC (_("Failed to add inter-thread communication channel FD to epoll 
set to signal termination\n"));
-}
-#endif
-
-
 /**
  * Shutdown an HTTP daemon.
  *
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 8b15db97..5acc21d9 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1104,7 +1104,7 @@ struct MHD_UpgradeResponseHandle
    * connection to cleanup list.
    * @remark This flag could be changed from any thread.
    */
-  bool was_closed;
+  volatile bool was_closed;
 
   /**
    * Set to #MHD_YES if connection is ready for cleanup.
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 4ea251d3..d9055416 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -667,13 +667,6 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
       return MHD_NO; /* Already closed. */
 
     /* transition to special 'closed' state for start of cleanup */
-    urh->was_closed = true;
-    EXTRA_CHECK (MHD_CONNECTION_UPGRADE == connection->state);
-    connection->state = MHD_CONNECTION_UPGRADE_CLOSED;
-    /* As soon as connection will be marked with BOTH
-     * 'urh->was_closed' AND 'urh->clean_ready', it will
-     * be moved to cleanup list by MHD_resume_connection(). */
-    MHD_resume_connection (connection);
 #ifdef HTTPS_SUPPORT
     if (0 != (daemon->options & MHD_USE_TLS) )
       {
@@ -683,6 +676,13 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
                   SHUT_RDWR);
       }
 #endif /* HTTPS_SUPPORT */
+    urh->was_closed = true;
+    EXTRA_CHECK (MHD_CONNECTION_UPGRADE == connection->state);
+    connection->state = MHD_CONNECTION_UPGRADE_CLOSED;
+    /* As soon as connection will be marked with BOTH
+     * 'urh->was_closed' AND 'urh->clean_ready', it will
+     * be moved to cleanup list by MHD_resume_connection(). */
+    MHD_resume_connection (connection);
     return MHD_YES;
   default:
     /* we don't understand this one */

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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