diff options
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 33 |
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 | */ | ||
1988 | static void | ||
1989 | server_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); |