gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated: Fixed init and deinit of mutex


From: gnunet
Subject: [libmicrohttpd] branch master updated: Fixed init and deinit of mutex
Date: Sat, 26 Dec 2020 12:29:42 +0100

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 8c1dfff2 Fixed init and deinit of mutex
8c1dfff2 is described below

commit 8c1dfff29d348b0d6cecf0cacf8d311afc5c4235
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sat Dec 26 14:16:31 2020 +0300

    Fixed init and deinit of mutex
---
 src/microhttpd/daemon.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 5fab773c..42c747c8 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -6985,6 +6985,17 @@ MHD_start_daemon_va (unsigned int flags,
       }
     }
   }
+  else
+  { /* Daemon without internal threads */
+    if (! MHD_mutex_init_ (&d->new_connections_mutex))
+    {
+#ifdef HAVE_MESSAGES
+      MHD_DLOG (daemon,
+                _ ("Failed to initialise mutex.\n"));
+#endif
+      goto free_and_fail;
+    }
+  }
 #endif
 #ifdef HTTPS_SUPPORT
   /* API promises to never use the password after initialization,
@@ -7372,12 +7383,16 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
         MHD_PANIC (_ ("Failed to join a thread.\n"));
       }
       /* close_all_connections() was called in daemon thread. */
+      MHD_mutex_destroy_chk_ (&daemon->new_connections_mutex);
     }
     else
 #endif
     {
       /* No internal threads are used for polling sockets. */
       close_all_connections (daemon);
+#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
+      MHD_mutex_destroy_chk_ (&daemon->new_connections_mutex);
+#endif /* MHD_USE_POSIX_THREADS || MHD_USE_W32_THREADS */
     }
     mhd_assert (NULL == daemon->connections_head);
     mhd_assert (NULL == daemon->cleanup_head);
@@ -7389,7 +7404,6 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
 
     if (MHD_ITC_IS_VALID_ (daemon->itc))
       MHD_itc_destroy_chk_ (daemon->itc);
-    MHD_mutex_destroy_chk_ (&daemon->new_connections_mutex);
 
 #ifdef EPOLL_SUPPORT
     if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&

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