gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r28612 - libmicrohttpd/src/microhttpd
Date: Wed, 14 Aug 2013 07:55:35 +0200

Author: LRN
Date: 2013-08-14 07:55:35 +0200 (Wed, 14 Aug 2013)
New Revision: 28612

Modified:
   libmicrohttpd/src/microhttpd/daemon.c
Log:
W32: shutdown a socket for writing before closing it

Turns out that closing a socket while having unread data in recv buffer
causes winsock to terminate the connection without sending any pending
data.
This is fixed by shutting down socket for writing before closing it.


Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2013-08-14 04:36:46 UTC (rev 
28611)
+++ libmicrohttpd/src/microhttpd/daemon.c       2013-08-14 05:55:35 UTC (rev 
28612)
@@ -1582,9 +1582,14 @@
          MHD_destroy_response (pos->response);
          pos->response = NULL;
        }
-      if ( (-1 != pos->socket_fd) &&
-          (0 != CLOSE (pos->socket_fd)) )
-       MHD_PANIC ("close failed\n");
+      if (-1 != pos->socket_fd)
+       {
+#ifdef WINDOWS
+         SHUTDOWN (pos->socket_fd, SHUT_WR);
+#endif
+         if (0 != CLOSE (pos->socket_fd))
+           MHD_PANIC ("close failed\n");
+       }
       if (NULL != pos->addr)
        free (pos->addr);
       free (pos);




reply via email to

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