Bläddra i källkod

MHD_start_daemon(): obey MHD_USE_ITC in thread pool mode

Evgeny Grin (Karlson2k) 9 år sedan
förälder
incheckning
6f6a4e220b
2 ändrade filer med 15 tillägg och 11 borttagningar
  1. 5 0
      ChangeLog
  2. 10 11
      src/microhttpd/daemon.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Sun Mar 26 13:49:01 MSK 2017
+	Internal refactoring for simplification and unification.
+	Minor optimizations and minor fixes.
+	MHD_USE_ITC used again in thread pool mode. -EG
+
 Sat Mar 25 20:58:24 CET 2017
 	Remove dead MHD_strx_to_sizet-functions and associated
 	test cases from code. -CG

+ 10 - 11
src/microhttpd/daemon.c

@@ -5955,8 +5955,7 @@ MHD_start_daemon_va (unsigned int flags,
           d->worker_pool_size = 0;
           d->worker_pool = NULL;
 
-          /* Always use individual control ITCs */
-          if (1)
+          if (0 != (*pflags & MHD_USE_ITC))
             {
               if (! MHD_itc_init_ (d->itc))
                 {
@@ -5967,17 +5966,17 @@ MHD_start_daemon_va (unsigned int flags,
 #endif
                   goto thread_failed;
                 }
-            }
-          if ( (0 == (*pflags & (MHD_USE_POLL | MHD_USE_EPOLL))) &&
-               (! MHD_SCKT_FD_FITS_FDSET_(MHD_itc_r_fd_ (d->itc),
-                                          NULL)) )
-            {
+              if ( (0 == (*pflags & (MHD_USE_POLL | MHD_USE_EPOLL))) &&
+                   (! MHD_SCKT_FD_FITS_FDSET_(MHD_itc_r_fd_ (d->itc),
+                                              NULL)) )
+                {
 #ifdef HAVE_MESSAGES
-              MHD_DLOG (daemon,
-                        _("File descriptor for worker inter-thread communication channel exceeds maximum value\n"));
+                  MHD_DLOG (daemon,
+                            _("File descriptor for worker inter-thread communication channel exceeds maximum value\n"));
 #endif
-              MHD_itc_destroy_chk_ (d->itc);
-              goto thread_failed;
+                  MHD_itc_destroy_chk_ (d->itc);
+                  goto thread_failed;
+                }
             }
 
           /* Divide available connections evenly amongst the threads.