gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (7138f352 -> 035048e6)


From: gnunet
Subject: [libmicrohttpd] branch master updated (7138f352 -> 035048e6)
Date: Mon, 21 Sep 2020 10:31:46 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 7138f352 Updated HTTP headers names, status codes and methods
     new 33628f62 mhd_itc_types.h: added macro for static initialisation
     new 035048e6 test_upgrade_large.c: used portable way of inter-thread 
communication

The 2 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:
 src/microhttpd/Makefile.am          |  4 ++--
 src/microhttpd/mhd_itc_types.h      | 16 ++++++++++++++++
 src/microhttpd/test_upgrade_large.c | 36 ++++++++++++++++--------------------
 3 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am
index 87de3c9b..5292593f 100644
--- a/src/microhttpd/Makefile.am
+++ b/src/microhttpd/Makefile.am
@@ -233,7 +233,7 @@ test_upgrade_LDADD = \
   $(PTHREAD_LIBS)
 
 test_upgrade_large_SOURCES = \
-  test_upgrade_large.c test_helpers.h mhd_sockets.h
+  test_upgrade_large.c test_helpers.h mhd_sockets.h mhd_sockets.c mhd_itc.h 
mhd_itc_types.h mhd_itc.c
 test_upgrade_large_CPPFLAGS = \
   $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS)
 test_upgrade_large_CFLAGS = \
@@ -259,7 +259,7 @@ test_upgrade_tls_LDADD = \
   $(PTHREAD_LIBS)
 
 test_upgrade_large_tls_SOURCES = \
-  test_upgrade_large.c test_helpers.h mhd_sockets.h
+  test_upgrade_large.c test_helpers.h mhd_sockets.h mhd_sockets.c mhd_itc.h 
mhd_itc_types.h mhd_itc.c
 test_upgrade_large_tls_CPPFLAGS = \
   $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS)
 test_upgrade_large_tls_CFLAGS = \
diff --git a/src/microhttpd/mhd_itc_types.h b/src/microhttpd/mhd_itc_types.h
index 36d4218b..bb354d37 100644
--- a/src/microhttpd/mhd_itc_types.h
+++ b/src/microhttpd/mhd_itc_types.h
@@ -47,6 +47,12 @@ struct MHD_itc_
   int fd;
 };
 
+/**
+ * Static initialiser for struct MHD_itc_
+ */
+#define MHD_ITC_STATIC_INIT_INVALID { -1 }
+
+
 #elif defined(_MHD_ITC_PIPE)
 /* **************** Standard UNIX ITC implementation by pipe ********** */
 
@@ -58,6 +64,11 @@ struct MHD_itc_
   int fd[2];
 };
 
+/**
+ * Static initialiser for struct MHD_itc_
+ */
+#define MHD_ITC_STATIC_INIT_INVALID { -1, -1 }
+
 
 #elif defined(_MHD_ITC_SOCKETPAIR)
 /* **************** ITC implementation by socket pair ********** */
@@ -72,6 +83,11 @@ struct MHD_itc_
   MHD_socket sk[2];
 };
 
+/**
+ * Static initialiser for struct MHD_itc_
+ */
+#define MHD_ITC_STATIC_INIT_INVALID { MHD_INVALID_SOCKET, MHD_INVALID_SOCKET }
+
 #endif /* _MHD_ITC_SOCKETPAIR */
 
 #endif /* ! MHD_ITC_TYPES_H */
diff --git a/src/microhttpd/test_upgrade_large.c 
b/src/microhttpd/test_upgrade_large.c
index 43c04b7f..a4d339ad 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -48,6 +48,7 @@
 
 #include "platform.h"
 #include "microhttpd.h"
+#include "mhd_itc.h"
 
 #include "test_helpers.h"
 
@@ -69,7 +70,7 @@
 
 static int verbose = 0;
 
-static int kicker[2] = {-1, -1};
+static struct MHD_itc_ kicker = MHD_ITC_STATIC_INIT_INVALID;
 
 enum tls_tool
 {
@@ -588,9 +589,9 @@ make_blocking (MHD_socket fd)
 static void
 kick_select ()
 {
-  if (-1 != kicker[1])
+  if (MHD_ITC_IS_VALID_(kicker))
   {
-    (void) write (kicker[1], "K", 1);
+    MHD_itc_activate_ (kicker, "K");
   }
 }
 
@@ -917,9 +918,8 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
   MHD_socket max_fd;
   MHD_UNSIGNED_LONG_LONG to;
   struct timeval tv;
-  char drain[128];
 
-  if (0 != pipe (kicker))
+  if (!MHD_itc_init_ (kicker))
     abort ();
   while (! done)
   {
@@ -929,7 +929,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
     max_fd = -1;
     to = 1000;
 
-    FD_SET (kicker[0], &rs);
+    FD_SET (MHD_itc_r_fd_ (kicker), &rs);
     if (MHD_YES !=
         MHD_get_fdset (daemon,
                        &rs,
@@ -949,17 +949,15 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
                              &es,
                              &tv))
       abort ();
-    if (FD_ISSET (kicker[0], &rs))
-      (void) read (kicker[0], drain, sizeof (drain));
+    if (FD_ISSET (MHD_itc_r_fd_ (kicker), &rs))
+      MHD_itc_clear_ (kicker);
     MHD_run_from_select (daemon,
                          &rs,
                          &ws,
                          &es);
   }
-  close (kicker[0]);
-  close (kicker[1]);
-  kicker[0] = -1;
-  kicker[1] = -1;
+  MHD_itc_destroy_ (kicker);
+  MHD_itc_set_invalid_ (kicker);
 }
 
 
@@ -1001,13 +999,13 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
   di = MHD_get_daemon_info (daemon,
                             MHD_DAEMON_INFO_EPOLL_FD);
   ep = di->listen_fd;
-  if (0 != pipe (kicker))
+  if (!MHD_itc_init_ (kicker))
     abort ();
   while (! done)
   {
     FD_ZERO (&rs);
     to = 1000;
-    FD_SET (kicker[0], &rs);
+    FD_SET (MHD_itc_r_fd_ (kicker), &rs);
     FD_SET (ep, &rs);
     (void) MHD_get_timeout (daemon,
                             &to);
@@ -1024,14 +1022,12 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
          (EAGAIN != errno) &&
          (EINTR != errno) )
       abort ();
-    if (FD_ISSET (kicker[0], &rs))
-      (void) read (kicker[0], drain, sizeof (drain));
+    if (FD_ISSET (MHD_itc_r_fd_ (kicker), &rs))
+      MHD_itc_clear_ (kicker);
     MHD_run (daemon);
   }
-  close (kicker[0]);
-  close (kicker[1]);
-  kicker[0] = -1;
-  kicker[1] = -1;
+  MHD_itc_destroy_ (kicker);
+  MHD_itc_set_invalid_ (kicker);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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