gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] GNU libmicrohttpd branch master updated. 56


From: gitolite
Subject: [GNUnet-SVN] [libmicrohttpd] GNU libmicrohttpd branch master updated. 56cccc6da257000049292016e1bda822c3934967
Date: Fri, 14 Oct 2016 15:50:46 +0200 (CEST)

The branch, master has been updated
       via  56cccc6da257000049292016e1bda822c3934967 (commit)
      from  947ab9361f6ed36141ff4adfc8265b728d0f2cf9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 56cccc6da257000049292016e1bda822c3934967
Author: Evgeny Grin (Karlson2k) <address@hidden>
Date:   Fri Oct 14 16:50:18 2016 +0300

    epoll FD is not MHD_socket type, adjust and unify usage

-----------------------------------------------------------------------

Summary of changes:
 src/microhttpd/daemon.c   | 10 +++++-----
 src/microhttpd/internal.h |  9 +++++++++
 src/microhttpd/response.c |  2 +-
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 12c5a36..47ab03a 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2540,7 +2540,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
                            pos);
               pos->epoll_state &= ~MHD_EPOLL_STATE_IN_EREADY_EDLL;
             }
-          if ( (MHD_INVALID_SOCKET != daemon->epoll_fd) &&
+          if ( (-1 != daemon->epoll_fd) &&
                (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EPOLL_SET)) )
             {
               /* epoll documentation suggests that closing a FD
@@ -3402,7 +3402,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
     }
 #if HTTPS_SUPPORT
   if ( (MHD_NO == daemon->upgrade_fd_in_epoll) &&
-       (MHD_INVALID_SOCKET != daemon->epoll_upgrade_fd) )
+       (-1 != daemon->epoll_upgrade_fd) )
     {
       event.events = EPOLLIN | EPOLLOUT;
       event.data.ptr = (void *) upgrade_marker;
@@ -4298,7 +4298,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
   struct epoll_event event;
 
   daemon->epoll_fd = setup_epoll_fd (daemon);
-  if (MHD_INVALID_SOCKET == daemon->epoll_fd)
+  if (-1 == daemon->epoll_fd)
     return MHD_NO;
 #if HTTPS_SUPPORT
   if (MHD_USE_TLS_EPOLL_UPGRADE == (MHD_USE_TLS_EPOLL_UPGRADE & 
daemon->options))
@@ -5310,10 +5310,10 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
          MHD_mutex_destroy_chk_ 
(&daemon->worker_pool[i].cleanup_connection_mutex);
 #ifdef EPOLL_SUPPORT
          if (-1 != daemon->worker_pool[i].epoll_fd)
-            MHD_socket_close_chk_ (daemon->worker_pool[i].epoll_fd);
+           MHD_fd_close_chk_ (daemon->worker_pool[i].epoll_fd);
 #if HTTPS_SUPPORT
          if (-1 != daemon->worker_pool[i].epoll_upgrade_fd)
-            MHD_socket_close_chk_ (daemon->worker_pool[i].epoll_upgrade_fd);
+           MHD_fd_close_chk_ (daemon->worker_pool[i].epoll_upgrade_fd);
 #endif
 #endif
           /* Individual ITCs are always used */
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 6e5ea67..be751c2 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -66,6 +66,15 @@
 
 
 /**
+ * Close FD and abort execution if error is detected.
+ * @param fd the FD to close
+ */
+#define MHD_fd_close_chk_(fd) do {             \
+    if (0 == close ((fd)) && (EBADF == errno)) \
+      MHD_PANIC(_("Failed to close FD.\n"));   \
+  } while(0)
+
+/**
  * Should we perform additional sanity checks at runtime (on our internal
  * invariants)?  This may lead to aborts, but can be useful for debugging.
  */
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 01bd377..afeccb5 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -808,7 +808,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response 
*response,
            to the event set of the daemon's `epoll_upgrade_fd` */
         struct epoll_event event;
 
-        EXTRA_CHECK (MHD_SOCKET_INVALID != daemon->epoll_upgrade_fd);
+        EXTRA_CHECK (-1 != daemon->epoll_upgrade_fd);
         /* First, add network socket */
         event.events = EPOLLIN | EPOLLOUT;
         event.data.ptr = &urh->app;


hooks/post-receive
-- 
GNU libmicrohttpd



reply via email to

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