gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated: Fixed HTTP "upgrade"


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated: Fixed HTTP "upgrade" after 7d3050325e3b77a061b40ea9ce77a360d14b4dea
Date: Sun, 21 May 2017 22:01:47 +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 e03de7c2 Fixed HTTP "upgrade" after 
7d3050325e3b77a061b40ea9ce77a360d14b4dea
e03de7c2 is described below

commit e03de7c2016df62e82a1c38226e12e2a2acda69e
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Sun May 21 23:01:21 2017 +0300

    Fixed HTTP "upgrade" after 7d3050325e3b77a061b40ea9ce77a360d14b4dea
---
 src/microhttpd/daemon.c   | 91 ++++++++++++++++++++++++++++-------------------
 src/microhttpd/internal.h | 11 ++++++
 src/microhttpd/response.c |  2 +-
 3 files changed, 66 insertions(+), 38 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 9aa18b37..71a0ce0b 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2699,29 +2699,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
 
 
 /**
- * Suspend handling of network data for a given connection.  This can
- * be used to dequeue a connection from MHD's event loop (external
- * select, internal select or thread pool; not applicable to
- * thread-per-connection!) for a while.
- *
- * If you use this API in conjunction with a internal select or a
- * thread pool, you must set the option #MHD_USE_ITC to
- * ensure that a resumed connection is immediately processed by MHD.
- *
- * Suspended connections continue to count against the total number of
- * connections allowed (per daemon, as well as per IP, if such limits
- * are set).  Suspended connections will NOT time out; timeouts will
- * restart when the connection handling is resumed.  While a
- * connection is suspended, MHD will not detect disconnects by the
- * client.
- *
- * The only safe time to suspend a connection is from the
- * #MHD_AccessHandlerCallback.
- *
- * Finally, it is an API violation to call #MHD_stop_daemon while
- * having suspended connections (this will at least create memory and
- * socket leaks or lead to undefined behavior).  You must explicitly
- * resume all connections before stopping the daemon.
+ * Internal version of ::MHD_suspend_connection().
  *
  * @remark In thread-per-connection mode: can be called from any thread,
  * in any other mode: to be called only from thread that process
@@ -2730,24 +2708,11 @@ internal_add_connection (struct MHD_Daemon *daemon,
  * @param connection the connection to suspend
  */
 void
-MHD_suspend_connection (struct MHD_Connection *connection)
+internal_suspend_connection_ (struct MHD_Connection *connection)
 {
   struct MHD_Daemon *daemon = connection->daemon;
 
-  if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME))
-    MHD_PANIC (_("Cannot suspend connections without enabling 
MHD_ALLOW_SUSPEND_RESUME!\n"));
   MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
-#ifdef UPGRADE_SUPPORT
-  if (NULL != connection->urh)
-    {
-#ifdef HAVE_MESSAGES
-      MHD_DLOG (daemon,
-                _("Error: connection sheduled for \"upgrade\" cannot be 
suspended"));
-#endif /* HAVE_MESSAGES */
-      MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
-      return;
-    }
-#endif /* UPGRADE_SUPPORT */
   if (connection->resuming)
     {
       /* suspending again while we didn't even complete resuming yet */
@@ -2801,6 +2766,58 @@ MHD_suspend_connection (struct MHD_Connection 
*connection)
 
 
 /**
+ * Suspend handling of network data for a given connection.  This can
+ * be used to dequeue a connection from MHD's event loop (external
+ * select, internal select or thread pool; not applicable to
+ * thread-per-connection!) for a while.
+ *
+ * If you use this API in conjunction with a internal select or a
+ * thread pool, you must set the option #MHD_USE_ITC to
+ * ensure that a resumed connection is immediately processed by MHD.
+ *
+ * Suspended connections continue to count against the total number of
+ * connections allowed (per daemon, as well as per IP, if such limits
+ * are set).  Suspended connections will NOT time out; timeouts will
+ * restart when the connection handling is resumed.  While a
+ * connection is suspended, MHD will not detect disconnects by the
+ * client.
+ *
+ * The only safe time to suspend a connection is from the
+ * #MHD_AccessHandlerCallback.
+ *
+ * Finally, it is an API violation to call #MHD_stop_daemon while
+ * having suspended connections (this will at least create memory and
+ * socket leaks or lead to undefined behavior).  You must explicitly
+ * resume all connections before stopping the daemon.
+ *
+ * @remark In thread-per-connection mode: can be called from any thread,
+ * in any other mode: to be called only from thread that process
+ * daemon's select()/poll()/etc.
+ *
+ * @param connection the connection to suspend
+ */
+void
+MHD_suspend_connection (struct MHD_Connection *connection)
+{
+  struct MHD_Daemon * const daemon = connection->daemon;
+
+  if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME))
+    MHD_PANIC (_("Cannot suspend connections without enabling 
MHD_ALLOW_SUSPEND_RESUME!\n"));
+#ifdef UPGRADE_SUPPORT
+  if (NULL != connection->urh)
+    {
+#ifdef HAVE_MESSAGES
+      MHD_DLOG (daemon,
+                _("Error: connection scheduled for \"upgrade\" cannot be 
suspended"));
+#endif /* HAVE_MESSAGES */
+      return;
+    }
+#endif /* UPGRADE_SUPPORT */
+  internal_suspend_connection_ (connection);
+}
+
+
+/**
  * Resume handling of network data for suspended connection.  It is
  * safe to resume a suspended connection at any time.  Calling this function
  * on a connection that was not previously suspended will result
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index ac7531f1..731416d9 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1926,5 +1926,16 @@ MHD_check_response_header_token_ci (const struct 
MHD_Response *response,
 #define MHD_check_response_header_s_token_ci(r,k,tkn) \
     MHD_check_response_header_token_ci((r),(k),(tkn),MHD_STATICSTR_LEN_(tkn))
 
+/**
+ * Internal version of ::MHD_suspend_connection().
+ *
+ * @remark In thread-per-connection mode: can be called from any thread,
+ * in any other mode: to be called only from thread that process
+ * daemon's select()/poll()/etc.
+ *
+ * @param connection the connection to suspend
+ */
+void
+internal_suspend_connection_ (struct MHD_Connection *connection);
 
 #endif
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 5ab97b35..7b2b4eb7 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -962,7 +962,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response 
*response,
   /* As far as MHD's event loops are concerned, this connection is
      suspended; it will be resumed once application is done by the
      #MHD_upgrade_action() function */
-  MHD_suspend_connection (connection);
+  internal_suspend_connection_ (connection);
 
   /* hand over socket to application */
   response->upgrade_handler (response->upgrade_handler_cls,

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



reply via email to

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