View Issue Details

IDProjectCategoryView StatusLast Update
0001674libmicrohttpdexternal APIpublic2011-04-27 16:15
ReporterHawk Assigned ToChristian Grothoff  
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.9 
Summary0001674: MHD_stop_daemon block on cygwin
DescriptionHello,

MHD_stop_daemon block on cygwin when using (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL).

MHD_stop_daemon call MHD_poll_listen_socket and MHD_poll_listen_socket
never return. I have signaled this bug to cygwin :

http://cygwin.com/ml/cygwin/2011-04/msg00086.html

I propose a workaround for this bug.
TagsNo tags attached.
Attached Files
cygwin.patch (535 bytes)   
--- src/daemon/daemon.c_ori	2011-04-07 10:56:24.828125000 +0200
+++ src/daemon/daemon.c	2011-04-07 11:07:21.515625000 +0200
@@ -1459,12 +1459,16 @@
   p.fd = daemon->socket_fd;
   p.events = POLLIN;
   p.revents = 0;
+#ifdef __CYGWIN__
+  timeout = 2000;
+#else
   if (may_block == MHD_NO)
     timeout = 0;
   else if (MHD_YES != MHD_get_timeout (daemon, &ltimeout))
     timeout = -1;
   else
     timeout = (ltimeout > INT_MAX) ? INT_MAX : (int) ltimeout;
+#endif
   if (poll (&p, 1, timeout) < 0)
     {
       if (errno == EINTR)
cygwin.patch (535 bytes)   

Activities

Christian Grothoff

2011-04-08 11:49

manager   ~0004304

Fixed in SVN 14928.

Hawk

2011-04-08 13:10

reporter   ~0004305

Hello, i have add a printf
-------------
#ifdef __CYGWIN__
  /* See https://gnunet.org/bugs/view.php?id=1674 */
  timeout = (timeout > 2000) ? 2000 : timeout;
        printf("timeout=%d\n", timeout);
#endif
------------
the result are : timeout=-1

and the poll function never return

if propose changing

    timeout = (timeout > 2000) ? 2000 : timeout;

in

    timeout = ((timeout > 2000) || (timeout <= 0)) ? 2000 : timeout;

Christian Grothoff

2011-04-09 16:12

manager   ~0004306

Well, almost, clearly it should be "timeout < 0" (0 means to return immediately, not after 2000ms). Done in SVN 14938.

Issue History

Date Modified Username Field Change
2011-04-07 11:17 Hawk New Issue
2011-04-07 11:17 Hawk File Added: cygwin.patch
2011-04-08 11:49 Christian Grothoff Note Added: 0004304
2011-04-08 11:49 Christian Grothoff Status new => resolved
2011-04-08 11:49 Christian Grothoff Resolution open => fixed
2011-04-08 11:49 Christian Grothoff Assigned To => Christian Grothoff
2011-04-08 13:10 Hawk Note Added: 0004305
2011-04-08 13:10 Hawk Status resolved => feedback
2011-04-08 13:10 Hawk Resolution fixed => reopened
2011-04-09 16:12 Christian Grothoff Note Added: 0004306
2011-04-09 16:13 Christian Grothoff Status feedback => resolved
2011-04-09 16:13 Christian Grothoff Resolution reopened => fixed
2011-04-27 16:15 Christian Grothoff Status resolved => closed
2013-05-06 12:52 Christian Grothoff Category API => libmicrohttpd API
2024-01-21 13:24 Christian Grothoff Category libmicrohttpd API => external API