[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28486 - in libmicrohttpd: . src/include src/microhttpd
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28486 - in libmicrohttpd: . src/include src/microhttpd |
Date: |
Sat, 10 Aug 2013 20:41:01 +0200 |
Author: grothoff
Date: 2013-08-10 20:41:01 +0200 (Sat, 10 Aug 2013)
New Revision: 28486
Modified:
libmicrohttpd/ChangeLog
libmicrohttpd/src/include/microhttpd.h
libmicrohttpd/src/microhttpd/daemon.c
Log:
address #2984
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2013-08-10 15:34:19 UTC (rev 28485)
+++ libmicrohttpd/ChangeLog 2013-08-10 18:41:01 UTC (rev 28486)
@@ -1,3 +1,7 @@
+Sat Aug 10 20:39:27 CEST 2013
+ Use 'errno' to indicate why 'MHD_add_connection' failed
+ (#2984). -CG
+
Sat Aug 10 17:31:31 CEST 2013
Disable use of 'shutdown' on W32 always as winsock
doesn't properly behave with half-closed connections
Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h 2013-08-10 15:34:19 UTC (rev
28485)
+++ libmicrohttpd/src/include/microhttpd.h 2013-08-10 18:41:01 UTC (rev
28486)
@@ -1225,7 +1225,8 @@
* @param addrlen number of bytes in addr
* @return MHD_YES on success, MHD_NO if this daemon could
* not handle the connection (i.e. malloc failed, etc).
- * The socket will be closed in any case.
+ * The socket will be closed in any case; 'errno' is
+ * set to indicate further details about the error.
*/
int
MHD_add_connection (struct MHD_Daemon *daemon,
Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c 2013-08-10 15:34:19 UTC (rev
28485)
+++ libmicrohttpd/src/microhttpd/daemon.c 2013-08-10 18:41:01 UTC (rev
28486)
@@ -983,7 +983,8 @@
* @param addrlen number of bytes in addr
* @return MHD_YES on success, MHD_NO if this daemon could
* not handle the connection (i.e. malloc failed, etc).
- * The socket will be closed in any case.
+ * The socket will be closed in any case; 'errno' is
+ * set to indicate further details about the error.
*/
int
MHD_add_connection (struct MHD_Daemon *daemon,
@@ -994,6 +995,7 @@
struct MHD_Connection *connection;
int res_thread_create;
unsigned int i;
+ int eno;
#if OSX
static int on = 1;
#endif
@@ -1011,6 +1013,9 @@
/* all pools are at their connection limit, must refuse */
if (0 != CLOSE (client_socket))
MHD_PANIC ("close failed\n");
+#if ENFILE
+ errno = ENFILE;
+#endif
return MHD_NO;
}
@@ -1026,6 +1031,9 @@
#endif
if (0 != CLOSE (client_socket))
MHD_PANIC ("close failed\n");
+#if EINVAL
+ errno = EINVAL;
+#endif
return MHD_NO;
}
#endif
@@ -1046,6 +1054,9 @@
#endif
if (0 != CLOSE (client_socket))
MHD_PANIC ("close failed\n");
+#if ENFILE
+ errno = ENFILE;
+#endif
return MHD_NO;
}
@@ -1062,6 +1073,9 @@
if (0 != CLOSE (client_socket))
MHD_PANIC ("close failed\n");
MHD_ip_limit_del (daemon, addr, addrlen);
+#if EACCESS
+ errno = EACCESS;
+#endif
return MHD_NO;
}
@@ -1077,6 +1091,7 @@
if (NULL == (connection = malloc (sizeof (struct MHD_Connection))))
{
+ eno = errno;
#if HAVE_MESSAGES
MHD_DLOG (daemon,
"Error allocating memory: %s\n",
@@ -1085,6 +1100,7 @@
if (0 != CLOSE (client_socket))
MHD_PANIC ("close failed\n");
MHD_ip_limit_del (daemon, addr, addrlen);
+ errno = eno;
return MHD_NO;
}
memset (connection, 0, sizeof (struct MHD_Connection));
@@ -1100,12 +1116,16 @@
MHD_PANIC ("close failed\n");
MHD_ip_limit_del (daemon, addr, addrlen);
free (connection);
+#if ENOMEM
+ errno = ENOMEM;
+#endif
return MHD_NO;
}
connection->connection_timeout = daemon->connection_timeout;
if (NULL == (connection->addr = malloc (addrlen)))
{
+ eno = errno;
#if HAVE_MESSAGES
MHD_DLOG (daemon,
"Error allocating memory: %s\n",
@@ -1116,6 +1136,7 @@
MHD_ip_limit_del (daemon, addr, addrlen);
MHD_pool_destroy (connection->pool);
free (connection);
+ errno = eno;
return MHD_NO;
}
memcpy (connection->addr, addr, addrlen);
@@ -1196,6 +1217,9 @@
free (connection->addr);
free (connection);
MHD_PANIC ("Unknown credential type");
+#if EINVAL
+ errno = EINVAL;
+#endif
return MHD_NO;
}
gnutls_transport_set_ptr (connection->tls_session,
@@ -1231,6 +1255,7 @@
&MHD_handle_connection, connection);
if (0 != res_thread_create)
{
+ eno = errno;
#if HAVE_MESSAGES
MHD_DLOG (daemon, "Failed to create a thread: %s\n",
STRERROR (res_thread_create));
@@ -1252,6 +1277,7 @@
client_socket,
&event))
{
+ eno = errno;
#if HAVE_MESSAGES
if (0 != (daemon->options & MHD_USE_DEBUG))
MHD_DLOG (daemon,
@@ -1294,6 +1320,9 @@
MHD_pool_destroy (connection->pool);
free (connection->addr);
free (connection);
+#if EINVAL
+ errno = eno;
+#endif
return MHD_NO;
#endif
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28486 - in libmicrohttpd: . src/include src/microhttpd,
gnunet <=