aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r--src/microhttpd/daemon.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index faa6d3e9..013c84c5 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3270,6 +3270,44 @@ MHD_resume_connection (struct MHD_Connection *connection)
3270} 3270}
3271 3271
3272 3272
3273#ifdef UPGRADE_SUPPORT
3274/**
3275 * Mark upgraded connection as closed by application.
3276 *
3277 * The @a connection pointer must not be used after call of this function
3278 * as it may be freed in other thread immediately.
3279 * @param connection the upgraded connection to mark as closed by application
3280 */
3281void
3282upgraded_connection_mark_app_closed_ (struct MHD_Connection *connection)
3283{
3284 /* Cache 'daemon' here to avoid data races */
3285 struct MHD_Daemon *const daemon = connection->daemon;
3286#if defined(MHD_USE_THREADS)
3287 mhd_assert (NULL == daemon->worker_pool);
3288#endif /* MHD_USE_THREADS */
3289 mhd_assert (NULL != connection->urh);
3290 mhd_assert (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME));
3291
3292 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
3293 connection->urh->was_closed = true;
3294 connection->resuming = true;
3295 daemon->resuming = true;
3296 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
3297 if ( (MHD_ITC_IS_VALID_ (daemon->itc)) &&
3298 (! MHD_itc_activate_ (daemon->itc, "r")) )
3299 {
3300#ifdef HAVE_MESSAGES
3301 MHD_DLOG (daemon,
3302 _ ("Failed to signal resume via " \
3303 "inter-thread communication channel.\n"));
3304#endif
3305 }
3306}
3307
3308
3309#endif /* UPGRADE_SUPPORT */
3310
3273/** 3311/**
3274 * Run through the suspended connections and move any that are no 3312 * Run through the suspended connections and move any that are no
3275 * longer suspended back to the active state. 3313 * longer suspended back to the active state.