diff --git a/src/lib/connection_add.c b/src/lib/connection_add.c index 8d4f12ad..94d37442 100644 --- a/src/lib/connection_add.c +++ b/src/lib/connection_add.c @@ -369,7 +369,7 @@ thread_main_handle_connection (void *data) * moved immediately to cleanup list. Otherwise connection * will stay in suspended list until 'urh' will be marked * with 'was_closed' by application. */ - MHD_resume_connection (con); + MHD_request_resume (&con->request); /* skip usual clean up */ return (MHD_THRD_RTRN_TYPE_) 0; diff --git a/src/lib/daemon_epoll.c b/src/lib/daemon_epoll.c index 49f15307..1c336f41 100644 --- a/src/lib/daemon_epoll.c +++ b/src/lib/daemon_epoll.c @@ -188,7 +188,7 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon) * will be moved immediately to cleanup list. Otherwise * connection will stay in suspended list until 'pos' will * be marked with 'was_closed' by application. */ - MHD_resume_connection (pos->connection); + MHD_request_resume (&pos->connection->request); } } diff --git a/src/lib/daemon_poll.c b/src/lib/daemon_poll.c index d5660715..bc705aea 100644 --- a/src/lib/daemon_poll.c +++ b/src/lib/daemon_poll.c @@ -326,7 +326,7 @@ MHD_daemon_poll_all_ (struct MHD_Daemon *daemon, * moved immediately to cleanup list. Otherwise connection * will stay in suspended list until 'urh' will be marked * with 'was_closed' by application. */ - MHD_resume_connection(urh->connection); + MHD_request_resume (&urh->connection->request); } } #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ diff --git a/src/lib/daemon_select.c b/src/lib/daemon_select.c index abd6eacf..338b12d5 100644 --- a/src/lib/daemon_select.c +++ b/src/lib/daemon_select.c @@ -468,7 +468,7 @@ internal_run_from_select (struct MHD_Daemon *daemon, MHD_connection_finish_forward_ (urh->connection); urh->clean_ready = true; /* Resuming will move connection to cleanup list. */ - MHD_resume_connection(urh->connection); + MHD_request_resume (&urh->connection->request); } } #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ diff --git a/src/lib/internal.h b/src/lib/internal.h index 1e95698e..8d1f22d8 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -1541,6 +1541,11 @@ struct MHD_Daemon */ bool was_quiesced; + /** + * Is some connection wanting to resume? + */ + bool resuming; + /** * Allow reusing the address:port combination when binding. * See #MHD_daemon_listen_allow_address_reuse(). diff --git a/src/lib/request_resume.c b/src/lib/request_resume.c index cd642580..fcb9a5a3 100644 --- a/src/lib/request_resume.c +++ b/src/lib/request_resume.c @@ -42,7 +42,24 @@ void MHD_request_resume (struct MHD_Request *request) { - abort (); // not implemented... + struct MHD_Daemon *daemon = request->daemon; + + if (daemon->disallow_suspend_resume) + MHD_PANIC (_("Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n")); + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + request->connection->resuming = true; + daemon->resuming = true; + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (! MHD_itc_activate_ (daemon->itc, + "r")) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + MHD_SC_ITC_USE_FAILED, + _("Failed to signal resume via inter-thread communication channel.")); +#endif + } } /* end of request_resume.c */