aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amat.us>2017-06-25 17:40:52 -0500
committerDavid Barksdale <amatus@amat.us>2017-06-25 17:40:52 -0500
commit556ccd6d483b3678867c3829e6979c307df04450 (patch)
tree8a8e1b5d5b4a8d195270ed0fa92dd52f22e582ef /src
parent981cc68a63c71ba11aaca84f559f3cf86a29c0ec (diff)
downloadgnunet-556ccd6d483b3678867c3829e6979c307df04450.tar.gz
gnunet-556ccd6d483b3678867c3829e6979c307df04450.zip
[transport] Fix EBADF in select()
This fixes issue #3691.
Diffstat (limited to 'src')
-rw-r--r--src/transport/plugin_transport_http_server.c33
1 files changed, 33 insertions, 0 deletions
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,
1977 1977
1978 1978
1979/** 1979/**
1980 * Callback from MHD when a connection starts/stops
1981 *
1982 * @param cls closure with the `struct HTTP_Server_Plugin *`
1983 * @param connection connection handle
1984 * @param socket_context socket-specific pointer
1985 * @param toe reason for connection notification
1986 * @see #MHD_OPTION_NOTIFY_CONNECTION
1987 */
1988static void
1989server_connection_cb (void *cls,
1990 struct MHD_Connection *connection,
1991 void **socket_context,
1992 enum MHD_ConnectionNotificationCode toe)
1993{
1994 struct HTTP_Server_Plugin *plugin = cls;
1995 const union MHD_ConnectionInfo *info;
1996
1997 if (MHD_CONNECTION_NOTIFY_STARTED == toe)
1998 return;
1999
2000 /* Reschedule to remove closed socket from our select set */
2001 info = MHD_get_connection_info (connection,
2002 MHD_CONNECTION_INFO_DAEMON);
2003 GNUNET_assert (NULL != info);
2004 server_reschedule (plugin,
2005 info->daemon,
2006 GNUNET_YES);
2007}
2008
2009
2010/**
1980 * Check if incoming connection is accepted. 2011 * Check if incoming connection is accepted.
1981 * 2012 *
1982 * @param cls plugin as closure 2013 * @param cls plugin as closure
@@ -2257,6 +2288,8 @@ run_mhd_start_daemon (struct HTTP_Server_Plugin *plugin,
2257 GNUNET_MAX_MESSAGE_SIZE), 2288 GNUNET_MAX_MESSAGE_SIZE),
2258 MHD_OPTION_NOTIFY_COMPLETED, 2289 MHD_OPTION_NOTIFY_COMPLETED,
2259 &server_disconnect_cb, plugin, 2290 &server_disconnect_cb, plugin,
2291 MHD_OPTION_NOTIFY_CONNECTION,
2292 &server_connection_cb, plugin,
2260 MHD_OPTION_EXTERNAL_LOGGER, 2293 MHD_OPTION_EXTERNAL_LOGGER,
2261 &server_log, NULL, 2294 &server_log, NULL,
2262 MHD_OPTION_END); 2295 MHD_OPTION_END);