gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: [transport] Fix EBADF in se


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: [transport] Fix EBADF in select()
Date: Mon, 26 Jun 2017 00:42:15 +0200

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

david-barksdale pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 556ccd6d4 [transport] Fix EBADF in select()
556ccd6d4 is described below

commit 556ccd6d483b3678867c3829e6979c307df04450
Author: David Barksdale <address@hidden>
AuthorDate: Sun Jun 25 17:40:52 2017 -0500

    [transport] Fix EBADF in select()
    
    This fixes issue #3691.
---
 src/transport/plugin_transport_http_server.c | 33 ++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/src/transport/plugin_transport_http_server.c 
b/src/transport/plugin_transport_http_server.c
index 892d97050..d9fade44f 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -1977,6 +1977,37 @@ server_disconnect_cb (void *cls,
 
 
 /**
+ * Callback from MHD when a connection starts/stops
+ *
+ * @param cls closure with the `struct HTTP_Server_Plugin *`
+ * @param connection connection handle
+ * @param socket_context socket-specific pointer
+ * @param toe reason for connection notification
+ * @see #MHD_OPTION_NOTIFY_CONNECTION
+ */
+static void
+server_connection_cb (void *cls,
+                      struct MHD_Connection *connection,
+                      void **socket_context,
+                      enum MHD_ConnectionNotificationCode toe)
+{
+  struct HTTP_Server_Plugin *plugin = cls;
+  const union MHD_ConnectionInfo *info;
+
+  if (MHD_CONNECTION_NOTIFY_STARTED == toe)
+    return;
+
+  /* Reschedule to remove closed socket from our select set */
+  info = MHD_get_connection_info (connection,
+                                  MHD_CONNECTION_INFO_DAEMON);
+  GNUNET_assert (NULL != info);
+  server_reschedule (plugin,
+                     info->daemon,
+                     GNUNET_YES);
+}
+
+
+/**
  * Check if incoming connection is accepted.
  *
  * @param cls plugin as closure
@@ -2257,6 +2288,8 @@ run_mhd_start_daemon (struct HTTP_Server_Plugin *plugin,
                                        GNUNET_MAX_MESSAGE_SIZE),
                              MHD_OPTION_NOTIFY_COMPLETED,
                              &server_disconnect_cb, plugin,
+                             MHD_OPTION_NOTIFY_CONNECTION,
+                             &server_connection_cb, plugin,
                              MHD_OPTION_EXTERNAL_LOGGER,
                              &server_log, NULL,
                              MHD_OPTION_END);

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



reply via email to

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