From a106abc6f551cc29bf71dffd74c658688eaf0e6f Mon Sep 17 00:00:00 2001 From: mrcsys Date: Wed, 31 May 2006 19:39:34 +0000 Subject: added a helper function to determine how many nanohttp connections are active --- nanohttp/nanohttp-server.c | 23 ++++++++++++++++++++++- nanohttp/nanohttp-server.h | 3 ++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/nanohttp/nanohttp-server.c b/nanohttp/nanohttp-server.c index 090b9d4..4995723 100644 --- a/nanohttp/nanohttp-server.c +++ b/nanohttp/nanohttp-server.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-server.c,v 1.60 2006/05/19 14:49:17 m0gg Exp $ +* $Id: nanohttp-server.c,v 1.61 2006/05/31 19:39:34 mrcsys Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -321,6 +321,27 @@ httpd_get_protocol(void) return hssl_enabled()? "https" : "http"; } +/*-------------------------------------------------- +FUNCTION: httpd_get_conncount +----------------------------------------------------*/ +int +httpd_get_conncount(void) +{ + int i; + int c=0; + + for (i = 0;i<_httpd_max_connections; i++) + { + + if (_httpd_connection[i].flag == CONNECTION_IN_USE) + { + c++; + } + } + + return c; +} + /* * ----------------------------------------------------- * FUNCTION: httpd_services diff --git a/nanohttp/nanohttp-server.h b/nanohttp/nanohttp-server.h index 77b384f..a5e1be1 100644 --- a/nanohttp/nanohttp-server.h +++ b/nanohttp/nanohttp-server.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: nanohttp-server.h,v 1.20 2006/04/26 17:48:30 mrcsys Exp $ + * $Id: nanohttp-server.h,v 1.21 2006/05/31 19:39:34 mrcsys Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -89,6 +89,7 @@ extern "C" void httpd_set_timeout(int t); const char *httpd_get_protocol(void); + int httpd_get_conncount(void); hservice_t *httpd_services(void); -- cgit v1.1-32-gdbae