gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (c5b4a9de -> 9a224cc6)


From: gnunet
Subject: [libmicrohttpd] branch master updated (c5b4a9de -> 9a224cc6)
Date: Sat, 31 Oct 2020 18:58:57 +0100

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from c5b4a9de Upgraded connection: fixed use-after-free for 
thread-per-connection
     new cec7ee05 Fixed deadlock introduced by 
c5b4a9deb550ab5a8a0bb36103a9547da21f8982
     new 9a224cc6 Speed-up closure of upgraded connection with daemon shutdown

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/microhttpd/daemon.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 640964b8..f75d02b1 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1734,8 +1734,9 @@ thread_main_connection_upgrade (struct MHD_Connection 
*con)
       {
         struct timeval*tvp;
         struct timeval tv;
-        if ( (con->tls_read_ready) &&
-             (urh->in_buffer_used < urh->in_buffer_size))
+        if (((con->tls_read_ready) &&
+             (urh->in_buffer_used < urh->in_buffer_size)) ||
+            (daemon->shutdown))
         {         /* No need to wait if incoming data is already pending in 
TLS buffers. */
           tv.tv_sec = 0;
           tv.tv_usec = 0;
@@ -1792,8 +1793,9 @@ thread_main_connection_upgrade (struct MHD_Connection 
*con)
 
       urh_update_pollfd (urh, p);
 
-      if ( (con->tls_read_ready) &&
-           (urh->in_buffer_used < urh->in_buffer_size))
+      if (((con->tls_read_ready) &&
+           (urh->in_buffer_used < urh->in_buffer_size)) ||
+          (daemon->shutdown))
         timeout = 0;     /* No need to wait if incoming data is already 
pending in TLS buffers. */
       else
         timeout = -1;
@@ -7109,11 +7111,15 @@ close_all_connections (struct MHD_Daemon *daemon)
       mhd_assert (NULL != pos->urh);
       if (! pos->thread_joined)
       {
-        /* No need to unlock "cleanup" mutex as upgraded connection
-         * doesn't manipulate "cleanup" list. */
+        /* While "cleanup" list is not manipulated by "upgraded"
+         * connection, "cleanup" mutex is required for call of
+         * MHD_resume_connection() during finishing of "upgraded"
+         * thread. */
+        MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
         if (! MHD_join_thread_ (pos->pid.handle))
           MHD_PANIC (_ ("Failed to join a thread.\n"));
         pos->thread_joined = true;
+        MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
       }
     }
   }

-- 
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]