[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 02/03: daemon: added user options counter
From: |
gnunet |
Subject: |
[libmicrohttpd] 02/03: daemon: added user options counter |
Date: |
Mon, 15 Mar 2021 14:37:59 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 1717035dfbe31add394e414e4016cc3cee5f7fb4
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Mar 15 15:54:54 2021 +0300
daemon: added user options counter
---
src/microhttpd/daemon.c | 4 ++++
src/microhttpd/internal.h | 9 +++++++++
2 files changed, 13 insertions(+)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 916544fa..8f548945 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -5403,6 +5403,9 @@ parse_options_va (struct MHD_Daemon *daemon,
while (MHD_OPTION_END != (opt = (enum MHD_OPTION) va_arg (ap, int)))
{
+ /* Increase counter at start, so resulting value is number of
+ * processed options, including any failed ones. */
+ daemon->num_opts++;
switch (opt)
{
case MHD_OPTION_CONNECTION_MEMORY_LIMIT:
@@ -5784,6 +5787,7 @@ parse_options_va (struct MHD_Daemon *daemon,
#endif /* HAVE_MESSAGES */
break;
case MHD_OPTION_ARRAY:
+ daemon->num_opts--; /* Do not count MHD_OPTION_ARRAY */
oa = va_arg (ap, struct MHD_OptionItem*);
i = 0;
while (MHD_OPTION_END != (opt = oa[i].option))
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 06e7e4a7..dc38bada 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1920,6 +1920,15 @@ struct MHD_Daemon
* The size of queue for listen socket.
*/
unsigned int listen_backlog_size;
+
+ /**
+ * The number of user options used.
+ *
+ * Contains number of only meaningful options, i.e. #MHD_OPTION_END
+ * and #MHD_OPTION_ARRAY are not counted, while options inside
+ * #MHD_OPTION_ARRAY are counted.
+ */
+ size_t num_opts;
};
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.