[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17398 - in libmicrohttpd: . src/daemon
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17398 - in libmicrohttpd: . src/daemon |
Date: |
Wed, 12 Oct 2011 10:41:49 +0200 |
Author: grothoff
Date: 2011-10-12 10:41:49 +0200 (Wed, 12 Oct 2011)
New Revision: 17398
Modified:
libmicrohttpd/ChangeLog
libmicrohttpd/src/daemon/daemon.c
Log:
fixing #1824
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2011-10-12 08:37:58 UTC (rev 17397)
+++ libmicrohttpd/ChangeLog 2011-10-12 08:41:49 UTC (rev 17398)
@@ -1,3 +1,8 @@
+Wed Oct 12 10:40:12 CEST 2011
+ Made sockets blocking again for non-Linux platforms as non-blocking
+ sockets cause problems (#1824) on Cygwin but offer better performance
+ on Linux (see change on August 11 2011). -CG/pross
+
Fri Oct 7 19:50:07 CEST 2011
Fixed problems with testcases on W32. -LRN
Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c 2011-10-12 08:37:58 UTC (rev 17397)
+++ libmicrohttpd/src/daemon/daemon.c 2011-10-12 08:41:49 UTC (rev 17398)
@@ -768,40 +768,6 @@
/**
- * Set if a socket should use non-blocking IO.
- * @param fd socket
- */
-static void
-socket_set_nonblocking (int fd)
-{
-#if MINGW
- u_long mode;
- mode = 1;
- if (ioctlsocket (fd, FIONBIO, &mode) == SOCKET_ERROR)
- {
- SetErrnoFromWinsockError (WSAGetLastError ());
-#if HAVE_MESSAGES
- FPRINTF(stderr, "Failed to make socket non-blocking: %s\n",
- STRERROR (errno));
-#endif
- }
-#else
-
- /* not MINGW */
- int flags = fcntl (fd, F_GETFL);
- if ( (flags == -1) ||
- (0 != fcntl (fd, F_SETFL, flags | O_NONBLOCK)) )
- {
-#if HAVE_MESSAGES
- FPRINTF(stderr, "Failed to make socket non-blocking: %s\n",
- STRERROR (errno));
-#endif
- }
-#endif
-}
-
-
-/**
* Create a thread and set the attributes according to our options.
*
* @param thread handle to initialize
@@ -979,7 +945,22 @@
MHD_set_http_callbacks_ (connection);
connection->recv_cls = &recv_param_adapter;
connection->send_cls = &send_param_adapter;
- socket_set_nonblocking (connection->socket_fd);
+#if LINUX
+ {
+ /* non-blocking sockets perform better on Linux */
+ int flags = fcntl (fd, F_GETFL);
+ if ( (flags == -1) ||
+ (0 != fcntl (fd, F_SETFL, flags | O_NONBLOCK)) )
+ {
+#if HAVE_MESSAGES
+ FPRINTF(stderr, "Failed to make socket non-blocking: %s\n",
+ STRERROR (errno));
+#endif
+ }
+#endif
+ }
+#endif
+
#if HTTPS_SUPPORT
if (0 != (daemon->options & MHD_USE_SSL))
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17398 - in libmicrohttpd: . src/daemon,
gnunet <=