libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit ebd810e770e0147dde2251b02e92d2f16f538942
parent 81109453ca3d36f36bc4b0367f0677c03e234abe
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 17 Mar 2009 06:57:36 +0000

adding thread pool functionality -- code by Richard Alimi

Diffstat:
Msrc/daemon/daemon.c | 16++++++++++++++++
Msrc/daemon/internal.h | 5+++++
2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c @@ -65,6 +65,18 @@ #endif /** + * Trace up to and return master daemon. If the supplied daemon + * is a master, then return the daemon itself. + */ +static struct MHD_Daemon* +MHD_get_master (struct MHD_Daemon *daemon) +{ + while (NULL != daemon->master) + daemon = daemon->master; + return daemon; +} + +/** * Maintain connection count for single address. */ struct MHD_IPCount @@ -169,6 +181,8 @@ MHD_ip_limit_add(struct MHD_Daemon *daemon, void *node; int result; + daemon = MHD_get_master (daemon); + /* Ignore if no connection limit assigned */ if (daemon->per_ip_connection_limit == 0) return MHD_YES; @@ -227,6 +241,8 @@ MHD_ip_limit_del(struct MHD_Daemon *daemon, struct MHD_IPCount *found_key; void *node; + daemon = MHD_get_master (daemon); + /* Ignore if no connection limit assigned */ if (daemon->per_ip_connection_limit == 0) return; diff --git a/src/daemon/internal.h b/src/daemon/internal.h @@ -770,6 +770,11 @@ struct MHD_Daemon */ const char *https_mem_cert; #endif + + /** + * Pointer to master daemon (NULL if this is the master) + */ + struct MHD_Daemon *master; };