gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated (6c991e09 -> 64b53a4e


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated (6c991e09 -> 64b53a4e)
Date: Mon, 15 May 2017 19:22:09 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 6c991e09 Handle resumed connections and closed "upgraded" connections 
in thread-per-connection mode with select(), do not use zero delay in 
MHD_poll_listen_socket() if connections are resumed
     new e264d9ec Fixed response leak when upgrade failed
     new 64b53a4e Added more comments for start upgrade callback function.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/examples/upgrade_example.c | 8 ++++++++
 src/include/microhttpd.h       | 3 +++
 src/microhttpd/connection.c    | 9 +++------
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/examples/upgrade_example.c b/src/examples/upgrade_example.c
index 7a893d2f..af081408 100644
--- a/src/examples/upgrade_example.c
+++ b/src/examples/upgrade_example.c
@@ -158,6 +158,9 @@ run_usock (void *cls)
  * but instead use #MHD_upgrade_action() for special operations
  * on @a sock.
  *
+ * Data forwarding to "upgraded" @a sock will be started as soon
+ * as this function return.
+ *
  * Except when in 'thread-per-connection' mode, implementations
  * of this function should never block (as it will still be called
  * from within the main event loop).
@@ -225,6 +228,11 @@ uh_cb (void *cls,
      a clean shutdown, as the we stop the daemon even if a worker thread
      is still running. Alas, this is a simple example... */
   pthread_detach (pt);
+
+  /* This callback must return as soon as possible. */
+
+  /* Data forwarding to "upgraded" socket will be started
+   * after return from this callback. */
 }
 
 
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 58787d3a..d7b69136 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -2840,6 +2840,9 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
  * but instead use #MHD_upgrade_action() for special operations
  * on @a sock.
  *
+ * Data forwarding to "upgraded" @a sock will be started as soon
+ * as this function return.
+ *
  * Except when in 'thread-per-connection' mode, implementations
  * of this function should never block (as it will still be called
  * from within the main event loop).
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 958bf2ef..8a190053 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -3161,14 +3161,11 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
 #ifdef UPGRADE_SUPPORT
           if (NULL != connection->response->upgrade_handler)
             {
-              struct MHD_Response *resp_clr = connection->response;
-
               socket_start_normal_buffering (connection);
               connection->state = MHD_CONNECTION_UPGRADE;
-              connection->response = NULL;
               /* This connection is "upgraded".  Pass socket to application. */
               if (MHD_YES !=
-                  MHD_response_execute_upgrade_ (resp_clr,
+                  MHD_response_execute_upgrade_ (connection->response,
                                                  connection))
                 {
                   /* upgrade failed, fail hard */
@@ -3177,8 +3174,8 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
                   continue;
                 }
               /* Response is not required anymore for this connection. */
-              if (NULL != resp_clr)
-                MHD_destroy_response (resp_clr);
+              if (NULL != connection->response)
+                MHD_destroy_response (connection->response);
               continue;
             }
 #endif /* UPGRADE_SUPPORT */

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



reply via email to

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