gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libmicrohttpd] branch master updated (de821749 -> b3e48b50


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated (de821749 -> b3e48b50)
Date: Thu, 16 Mar 2017 15:05:19 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from de821749 MHD_connection_handle_idle(): fixed missing bracket
     new 6bd7866d union MHD_DaemonInfo: added epoll_fd to clearly use with 
epoll FD
     new 77bc8103 Added MHD_DAEMON_INFO_FLAGS to get daemon's flags by 
MHD_get_daemon_info()
     new 3f9f4d8b test_upgrade: fixed test with 'auto' flags
     new b3e48b50 Fixed compiler warnings, updated ChangeLog.

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ChangeLog                     |  5 +++++
 src/include/microhttpd.h      | 26 +++++++++++++++++++++++---
 src/microhttpd/daemon.c       |  4 ++++
 src/microhttpd/test_upgrade.c | 19 +++++++++++++++----
 4 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fa4e0f28..7cca315c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Mar 16 16:49:07 MSK 2017
+       Added ability to get actual daemon flags via MHD_get_daemon_info().
+       Fixed test_upgrade to work in request mode.
+       Fixed compiler warnings in test_upgrade. -EG
+
 Wed Mar 15 23:29:59 MSK 2017
        Prevented socket read/write if connection is suspended.
        Added missing resets of 'connection->in_idle'.
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index d7fc448a..79f57a19 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1796,7 +1796,15 @@ enum MHD_DaemonInfoType
    * Request the number of current connections handled by the daemon.
    * No extra arguments should be passed.
    */
-  MHD_DAEMON_INFO_CURRENT_CONNECTIONS
+  MHD_DAEMON_INFO_CURRENT_CONNECTIONS,
+
+  /**
+   * Request the daemon flags.
+   * No extra arguments should be passed.
+   * Note: flags may differ from original 'flags' specified for
+   * daemon, especially if #MHD_USE_AUTO was set.
+   */
+  MHD_DAEMON_INFO_FLAGS
 };
 
 
@@ -3171,15 +3179,27 @@ union MHD_DaemonInfo
   size_t mac_key_size;
 
   /**
-   * Socket, returned for #MHD_DAEMON_INFO_EPOLL_FD
-   * and #MHD_DAEMON_INFO_LISTEN_FD.
+   * Socket, returned for #MHD_DAEMON_INFO_LISTEN_FD.
    */
   MHD_socket listen_fd;
 
   /**
+   * epoll FD, returned for #MHD_DAEMON_INFO_EPOLL_FD.
+   */
+  int epoll_fd;
+
+  /**
    * Number of active connections, for #MHD_DAEMON_INFO_CURRENT_CONNECTIONS.
    */
   unsigned int num_connections;
+
+  /**
+   * Combination of #MHD_FLAG values, for #MHD_DAEMON_INFO_FLAGS.
+   * This value is actually a bitfield.
+   * Note: flags may differ from original 'flags' specified for
+   * daemon, especially if #MHD_USE_AUTO was set.
+   */
+  enum MHD_FLAG flags;
 };
 
 
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index b78aabb0..185421c7 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -101,6 +101,7 @@
 static void
 close_all_connections (struct MHD_Daemon *daemon);
 
+#ifdef EPOLL_SUPPORT
 
 /**
  * Do epoll()-based processing (this function is allowed to
@@ -114,6 +115,7 @@ static int
 MHD_epoll (struct MHD_Daemon *daemon,
           int may_block);
 
+#endif /* EPOLL_SUPPORT */
 
 /**
  * Default implementation of the panic function,
@@ -6259,6 +6261,8 @@ 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;
     default:
       return NULL;
     };
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index 01e963f1..fe72a70f 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -888,6 +888,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
     }
 }
 
+#ifdef HAVE_POLL
 
 /**
  * Run the MHD external event loop using select.
@@ -899,8 +900,10 @@ run_mhd_poll_loop (struct MHD_Daemon *daemon)
 {
   abort (); /* currently not implementable with existing MHD API */
 }
+#endif /* HAVE_POLL */
 
 
+#ifdef EPOLL_SUPPORT
 /**
  * Run the MHD external event loop using select.
  *
@@ -938,7 +941,7 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
       MHD_run (daemon);
     }
 }
-
+#endif /* EPOLL_SUPPORT */
 
 /**
  * Run the MHD external event loop using select.
@@ -949,14 +952,18 @@ static void
 run_mhd_loop (struct MHD_Daemon *daemon,
               int flags)
 {
-  if (0 != (flags & MHD_USE_POLL))
+  if (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL)))
+    run_mhd_select_loop (daemon);
+#ifdef HAVE_POLL
+  else if (0 != (flags & MHD_USE_POLL))
     run_mhd_poll_loop (daemon);
+#endif /* HAVE_POLL */
 #if EPOLL_SUPPORT
   else if (0 != (flags & MHD_USE_EPOLL))
     run_mhd_epoll_loop (daemon);
 #endif
   else
-    run_mhd_select_loop (daemon);
+    abort ();
 }
 
 static bool test_tls;
@@ -974,6 +981,7 @@ test_upgrade (int flags,
   struct MHD_Daemon *d = NULL;
   wr_socket sock;
   struct sockaddr_in sa;
+  const union MHD_DaemonInfo *real_flags;
 #if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID)
   pid_t pid = -1;
 #endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */
@@ -1006,6 +1014,9 @@ test_upgrade (int flags,
 #endif /* HTTPS_SUPPORT */
   if (NULL == d)
     return 2;
+  real_flags = MHD_get_daemon_info(d, MHD_DAEMON_INFO_FLAGS);
+  if (NULL == real_flags)
+    abort ();
   if (!test_tls || TLS_LIB_GNUTLS == use_tls_tool)
     {
       sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt ();
@@ -1042,7 +1053,7 @@ test_upgrade (int flags,
                            &sock))
     abort ();
   if (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD) )
-    run_mhd_loop (d, flags);
+    run_mhd_loop (d, real_flags->flags);
   pthread_join (pt_client,
                 NULL);
   pthread_join (pt,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]