gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37867 - libmicrohttpd/src/microhttpd


From: gnunet
Subject: [GNUnet-SVN] r37867 - libmicrohttpd/src/microhttpd
Date: Sun, 4 Sep 2016 13:25:48 +0200

Author: grothoff
Date: 2016-09-04 13:25:48 +0200 (Sun, 04 Sep 2016)
New Revision: 37867

Modified:
   libmicrohttpd/src/microhttpd/connection.c
   libmicrohttpd/src/microhttpd/mhd_sem.c
   libmicrohttpd/src/microhttpd/response.c
   libmicrohttpd/src/microhttpd/test_upgrade.c
Log:
-extend upgrade plaintext test to cover thread-per-connection mode, plus minor 
bugfix

Modified: libmicrohttpd/src/microhttpd/connection.c
===================================================================
--- libmicrohttpd/src/microhttpd/connection.c   2016-09-04 11:16:38 UTC (rev 
37866)
+++ libmicrohttpd/src/microhttpd/connection.c   2016-09-04 11:25:48 UTC (rev 
37867)
@@ -3185,6 +3185,7 @@
       return MHD_NO;
     }
   if ( (NULL != response->upgrade_handler) &&
+       (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
        (0 == (daemon->options & MHD_USE_SUSPEND_RESUME)) )
     {
 #ifdef HAVE_MESSAGES

Modified: libmicrohttpd/src/microhttpd/mhd_sem.c
===================================================================
--- libmicrohttpd/src/microhttpd/mhd_sem.c      2016-09-04 11:16:38 UTC (rev 
37866)
+++ libmicrohttpd/src/microhttpd/mhd_sem.c      2016-09-04 11:25:48 UTC (rev 
37867)
@@ -88,7 +88,7 @@
 void
 MHD_semaphore_down (struct MHD_Semaphore *sem)
 {
-  if (! pthread_mutex_lock (&sem->mutex))
+  if (0 != pthread_mutex_lock (&sem->mutex))
     MHD_PANIC ("pthread_mutex_lock for semaphore failed\n");
   while (0 == sem->counter)
     {
@@ -97,7 +97,7 @@
         MHD_PANIC ("pthread_cond_wait failed\n");
     }
   sem->counter--;
-  if (! pthread_mutex_unlock (&sem->mutex))
+  if (0 != pthread_mutex_unlock (&sem->mutex))
     MHD_PANIC ("pthread_mutex_unlock for semaphore failed\n");
 }
 
@@ -110,11 +110,11 @@
 void
 MHD_semaphore_up (struct MHD_Semaphore *sem)
 {
-  if (! pthread_mutex_lock (&sem->mutex))
+  if (0 != pthread_mutex_lock (&sem->mutex))
     MHD_PANIC ("pthread_mutex_lock for semaphore failed\n");
   sem->counter++;
   pthread_cond_signal (&sem->cv);
-  if (! pthread_mutex_unlock (&sem->mutex))
+  if (0 != pthread_mutex_unlock (&sem->mutex))
     MHD_PANIC ("pthread_mutex_unlock for semaphore failed\n");
 }
 

Modified: libmicrohttpd/src/microhttpd/response.c
===================================================================
--- libmicrohttpd/src/microhttpd/response.c     2016-09-04 11:16:38 UTC (rev 
37866)
+++ libmicrohttpd/src/microhttpd/response.c     2016-09-04 11:25:48 UTC (rev 
37867)
@@ -867,13 +867,6 @@
   urh->app.socket = MHD_INVALID_SOCKET;
   urh->mhd.socket = MHD_INVALID_SOCKET;
 #endif
-  response->upgrade_handler (response->upgrade_handler_cls,
-                             connection,
-                             connection->client_context,
-                             connection->read_buffer,
-                             rbo,
-                             connection->socket_fd,
-                             urh);
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION) )
     {
       /* Need to give the thread something to block on... */
@@ -899,6 +892,13 @@
          #MHD_upgrade_action() function */
       MHD_suspend_connection (connection);
     }
+  response->upgrade_handler (response->upgrade_handler_cls,
+                             connection,
+                             connection->client_context,
+                             connection->read_buffer,
+                             rbo,
+                             connection->socket_fd,
+                             urh);
   return MHD_YES;
 }
 

Modified: libmicrohttpd/src/microhttpd/test_upgrade.c
===================================================================
--- libmicrohttpd/src/microhttpd/test_upgrade.c 2016-09-04 11:16:38 UTC (rev 
37866)
+++ libmicrohttpd/src/microhttpd/test_upgrade.c 2016-09-04 11:25:48 UTC (rev 
37867)
@@ -286,7 +286,9 @@
   MHD_socket sock;
   struct sockaddr_in sa;
 
-  d = MHD_start_daemon (flags | MHD_USE_DEBUG | MHD_USE_SUSPEND_RESUME,
+  if (0 == (flags & MHD_USE_THREAD_PER_CONNECTION))
+    flags |= MHD_USE_SUSPEND_RESUME;
+  d = MHD_start_daemon (flags | MHD_USE_DEBUG,
                         1080,
                         NULL, NULL,
                         &ahc_upgrade, NULL,
@@ -325,19 +327,23 @@
 {
   int error_count = 0;
 
+  error_count += test_upgrade_internal (MHD_USE_THREAD_PER_CONNECTION,
+                                        0);
+  error_count += test_upgrade_internal (MHD_USE_THREAD_PER_CONNECTION | 
MHD_USE_POLL,
+                                        0);
   error_count += test_upgrade_internal (MHD_USE_SELECT_INTERNALLY,
-                                        1);
+                                        0);
   error_count += test_upgrade_internal (MHD_USE_SELECT_INTERNALLY,
                                         2);
 #ifdef HAVE_POLL
   error_count += test_upgrade_internal (MHD_USE_POLL_INTERNALLY,
-                                        1);
+                                        0);
   error_count += test_upgrade_internal (MHD_USE_POLL_INTERNALLY,
                                         2);
 #endif
 #ifdef EPOLL_SUPPORT
   error_count += test_upgrade_internal (MHD_USE_EPOLL_INTERNALLY,
-                                        1);
+                                        0);
   error_count += test_upgrade_internal (MHD_USE_EPOLL_INTERNALLY,
                                         2);
 #endif




reply via email to

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