Done. So dudes, what do you think about this attached patch?

On Thu, May 4, 2017 at 10:45 AM, silvioprog <silviop...@gmail.com> wrote:

> On Thu, May 4, 2017 at 8:47 AM, Nicolas Mora <nico...@babelouest.org>
> wrote:
> [...]
>
>> Silvio's suggestion might work too, some signal like a
>> "MHD_DAEMON_INFO_WAS_QUIESCED" or, in my case "MHD_DAEMON_INFO_WAS_STOPPED".
>
>
> I'm going to send a patch to Evgeny ...
>

-- 
Silvio Clécio
From 91cec1d7e2a1c69dcf3978e70c4ee12cd9a21513 Mon Sep 17 00:00:00 2001
From: silvioprog <silviop...@gmail.com>
Date: Thu, 4 May 2017 10:58:26 -0300
Subject: [PATCH] Allows to check the server shutdown statuses.

---
 src/include/microhttpd.h | 20 +++++++++++++++++++-
 src/microhttpd/daemon.c  |  6 ++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index ca0059f..fa0b820 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1841,7 +1841,25 @@ enum MHD_DaemonInfoType
    * Note: flags may differ from original 'flags' specified for
    * daemon, especially if #MHD_USE_AUTO was set.
    */
-  MHD_DAEMON_INFO_FLAGS
+  MHD_DAEMON_INFO_FLAGS,
+
+  /**
+   * Check if the daemon was shut down.
+   * No extra arguments should be passed.
+   */
+  MHD_DAEMON_INFO_SHUTDOWN,
+
+  /**
+   * Check if the daemon was quiesced.
+   * No extra arguments should be passed.
+   */
+  MHD_DAEMON_INFO_QUIESCED,
+
+  /**
+   * Check if the daemon has data waiting to be processed.
+   * No extra arguments should be passed.
+   */
+  MHD_DAEMON_INFO_PENDING_DATA
 };
 
 
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index a91d268..dba818f 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -6470,6 +6470,12 @@ MHD_get_daemon_info (struct MHD_Daemon *daemon,
       return (const union MHD_DaemonInfo *) &daemon->connections;
     case MHD_DAEMON_INFO_FLAGS:
       return (const union MHD_DaemonInfo *) &daemon->options;
+    case MHD_DAEMON_INFO_SHUTDOWN:
+      return (const union MHD_DaemonInfo *) &daemon->shutdown;
+    case MHD_DAEMON_INFO_QUIESCED:
+      return (const union MHD_DaemonInfo *) &daemon->was_quiesced;
+    case MHD_DAEMON_INFO_PENDING_DATA:
+      return (const union MHD_DaemonInfo *) &daemon->data_already_pending;
     default:
       return NULL;
     };
-- 
2.7.4

Reply via email to