Sfoglia il codice sorgente

Improved thread-safe for MHD_set_connection_option()

Evgeny Grin (Karlson2k) 9 anni fa
parent
commit
ac82c4d331
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      src/microhttpd/connection.c

+ 2 - 0
src/microhttpd/connection.c

@@ -3373,6 +3373,7 @@ MHD_set_connection_option (struct MHD_Connection *connection,
   switch (option)
   switch (option)
     {
     {
     case MHD_CONNECTION_OPTION_TIMEOUT:
     case MHD_CONNECTION_OPTION_TIMEOUT:
+      MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
       if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
       if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
           (! connection->suspended) )
           (! connection->suspended) )
         {
         {
@@ -3401,6 +3402,7 @@ MHD_set_connection_option (struct MHD_Connection *connection,
                           daemon->manual_timeout_tail,
                           daemon->manual_timeout_tail,
                           connection);
                           connection);
         }
         }
+      MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
       return MHD_YES;
       return MHD_YES;
     default:
     default:
       return MHD_NO;
       return MHD_NO;