Christian Grothoff 12 years ago
parent
commit
e82e13bba5
3 changed files with 16 additions and 1 deletions
  1. 5 0
      ChangeLog
  2. 1 1
      src/include/microhttpd.h
  3. 10 0
      src/microhttpd/daemon.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Mon Dec  9 21:41:57 CET 2013
+	Fix for per-worker daemon pipes enabled with 
+	MHD_USE_SUSPEND_RESUME that were not closed in
+	MHD_stop_daemon. -MH
+
 Sat Dec  7 00:44:49 CET 2013
 	Fixing warnings and build issue if --disable-https is given
 	to configure. -CG

+ 1 - 1
src/include/microhttpd.h

@@ -121,7 +121,7 @@ extern "C"
  * Current version of the library.
  * 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00093201
+#define MHD_VERSION 0x00093202
 
 /**
  * MHD-internal return code for "YES".

+ 10 - 0
src/microhttpd/daemon.c

@@ -3978,6 +3978,16 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
 	       (0 != CLOSE (daemon->worker_pool[i].epoll_fd)) )
 	    MHD_PANIC ("close failed\n");
 #endif
+          if ( (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) )
+            {
+              if (-1 != daemon->worker_pool[i].wpipe[1])
+                {
+	           if (0 != CLOSE (daemon->worker_pool[i].wpipe[0]))
+	             MHD_PANIC ("close failed\n");
+	           if (0 != CLOSE (daemon->worker_pool[i].wpipe[1]))
+	             MHD_PANIC ("close failed\n");
+                }
+	    }
 	}
       free (daemon->worker_pool);
     }