[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34388 - in libmicrohttpd: . doc src/include src/microhttpd
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34388 - in libmicrohttpd: . doc src/include src/microhttpd |
Date: |
Wed, 29 Oct 2014 16:29:31 +0100 |
Author: grothoff
Date: 2014-10-29 16:29:31 +0100 (Wed, 29 Oct 2014)
New Revision: 34388
Modified:
libmicrohttpd/AUTHORS
libmicrohttpd/ChangeLog
libmicrohttpd/doc/libmicrohttpd.texi
libmicrohttpd/src/include/microhttpd.h
libmicrohttpd/src/microhttpd/daemon.c
Log:
From: Milan Straka <address@hidden>
Date: Wed, 29 Oct 2014 09:59:09 +0100
Subject: [PATCH 2/2] Add MHD_DAEMON_INFO_CURRENT_CONNECTIONS to
MHD_DaemonInfoType.
The MHD_DAEMON_INFO_CURRENT_CONNECTIONS returns number of current
connections handled by the daemon.
Useful after MHD_quiesce_daemon to find out whether all connections
have been served.
Modified: libmicrohttpd/AUTHORS
===================================================================
--- libmicrohttpd/AUTHORS 2014-10-29 15:22:14 UTC (rev 34387)
+++ libmicrohttpd/AUTHORS 2014-10-29 15:29:31 UTC (rev 34388)
@@ -25,6 +25,7 @@
David Reiss <address@hidden>
Matt Holiday
Michael Cronenworth <address@hidden>
+Milan Straka <address@hidden>
Mika Raento <address@hidden>
Mike Crowe <address@hidden>
John Muth <address@hidden>
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2014-10-29 15:22:14 UTC (rev 34387)
+++ libmicrohttpd/ChangeLog 2014-10-29 15:29:31 UTC (rev 34388)
@@ -1,3 +1,7 @@
+Wed Oct 29 16:27:05 CET 2014
+ Adding MHD_DAEMON_INFO_CURRENT_CONNECTIONS to allow clients
+ to query the number of active connections. -MS
+
Fri Oct 3 14:28:58 CEST 2014
Releasing 0.9.38. -CG
Modified: libmicrohttpd/doc/libmicrohttpd.texi
===================================================================
--- libmicrohttpd/doc/libmicrohttpd.texi 2014-10-29 15:22:14 UTC (rev
34387)
+++ libmicrohttpd/doc/libmicrohttpd.texi 2014-10-29 15:29:31 UTC (rev
34388)
@@ -2394,13 +2394,13 @@
Request information about the key size for a particular cipher
algorithm. The cipher algorithm should be passed as an extra argument
(of type 'enum MHD_GNUTLS_CipherAlgorithm'). No longer supported,
-using this value will cause MHD_get_daemon_info to return NULL.
+using this value will cause @code{MHD_get_daemon_info} to return NULL.
@item MHD_DAEMON_INFO_MAC_KEY_SIZE
Request information about the key size for a particular cipher
algorithm. The cipher algorithm should be passed as an extra argument
(of type 'enum MHD_GNUTLS_HashAlgorithm'). No longer supported,
-using this value will cause MHD_get_daemon_info to return NULL.
+using this value will cause @code{MHD_get_daemon_info} to return NULL.
@item MHD_DAEMON_INFO_LISTEN_FD
@cindex listen
@@ -2415,12 +2415,26 @@
Request the file-descriptor number that MHD is using for epoll. If
the build is not supporting epoll, NULL is returned; if we are using a
thread pool or this daemon was not started with
-MHD_USE_EPOLL_LINUX_ONLY, (a pointer to) -1 is returned. If we are
-using MHD_USE_SELECT_INTERNALLY or are in 'external' select mode, the
address@hidden, (a pointer to) -1 is returned. If we are
+using @code{MHD_USE_SELECT_INTERNALLY} or are in 'external' select mode, the
internal epoll FD is returned. This function must be used in external
select mode with epoll to obtain the FD to call epoll on. No extra
arguments should be passed.
address@hidden MHD_DAEMON_INFO_CURRENT_CONNECTIONS
address@hidden connection, limiting number of connections
+Request the number of current connections handled by the daemon. No
+extra arguments should be passed and a pointer to a @code{union
+MHD_DaemonInfo} value is returned, with the @code{num_connections}
+member of type @code{unsigned int} set to the number of active
+connections.
+
+Note that in multi-threaded or internal-select mode, the real number of current
+connections may already be different when @code{MHD_get_daemon_info} returns.
+The number of current connections can be used (even in multi-threaded and
+internal-select mode) after @code{MHD_quiesce_daemon} to detect whether all
+connections have been handled.
+
@end table
@end deftp
Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h 2014-10-29 15:22:14 UTC (rev
34387)
+++ libmicrohttpd/src/include/microhttpd.h 2014-10-29 15:29:31 UTC (rev
34388)
@@ -1111,7 +1111,13 @@
* Request the file descriptor for the external epoll.
* No extra arguments should be passed.
*/
- MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY
+ MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY,
+
+ /**
+ * Request the number of current connections handled by the daemon.
+ * No extra arguments should be passed.
+ */
+ MHD_DAEMON_INFO_CURRENT_CONNECTIONS,
};
@@ -2369,21 +2375,27 @@
union MHD_DaemonInfo
{
/**
- * Size of the key.
+ * Size of the key, no longer supported.
* @deprecated
*/
size_t key_size;
/**
- * Size of the mac key.
+ * Size of the mac key, no longer supported.
* @deprecated
*/
size_t mac_key_size;
/**
- * Listen socket file descriptor
+ * Listen socket file descriptor, for #MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY
+ * and #MHD_DAEMON_INFO_LISTEN_FD.
*/
MHD_socket listen_fd;
+
+ /**
+ * Number of active connections, for #MHD_DAEMON_INFO_CURRENT_CONNECTIONS.
+ */
+ unsigned int num_connections;
};
Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c 2014-10-29 15:22:14 UTC (rev
34387)
+++ libmicrohttpd/src/microhttpd/daemon.c 2014-10-29 15:29:31 UTC (rev
34388)
@@ -4232,6 +4232,17 @@
case MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY:
return (const union MHD_DaemonInfo *) &daemon->epoll_fd;
#endif
+ case MHD_DAEMON_INFO_CURRENT_CONNECTIONS:
+ if (daemon->worker_pool)
+ {
+ /* Collect the connection information stored in the workers. */
+ unsigned int i;
+
+ daemon->connections = 0;
+ for (i=0;i<daemon->worker_pool_size;i++)
+ daemon->connections += daemon->worker_pool[i].connections;
+ }
+ return (const union MHD_DaemonInfo *) &daemon->connections;
default:
return NULL;
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34388 - in libmicrohttpd: . doc src/include src/microhttpd,
gnunet <=