libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit ec79acc64c2617081dbf26dddb48a27e88a6b9b9
parent 76f6a033eb760b65bb055ad517cfd6cd3c04934e
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Wed, 24 Dec 2025 20:56:27 +0100

Renamed "from_timeout_lists()" to "deinit_activity_timeout()"

Diffstat:
Msrc/mhd2/conn_timeout.c | 40++++++++++++++++++++++++----------------
Msrc/mhd2/conn_timeout.h | 16++++++++--------
Msrc/mhd2/daemon_add_conn.c | 4+---
Msrc/mhd2/stream_funcs.c | 4++--
Msrc/mhd2/stream_process_states.c | 2+-
5 files changed, 36 insertions(+), 30 deletions(-)

diff --git a/src/mhd2/conn_timeout.c b/src/mhd2/conn_timeout.c @@ -135,6 +135,30 @@ mhd_conn_init_activity_timeout (struct MHD_Connection *restrict c, } +MHD_INTERNAL +MHD_FN_PAR_NONNULL_ALL_ void +mhd_conn_deinit_activity_timeout (struct MHD_Connection *restrict c) +{ + struct MHD_Daemon *const restrict d = c->daemon; + +#if defined(MHD_SUPPORT_THREADS) + mhd_assert (! mhd_D_HAS_WORKERS (d)); +#endif /* MHD_SUPPORT_THREADS */ + + if (mhd_D_HAS_THR_PER_CONN (d)) + return; + + if (c->connection_timeout_ms == d->conns.cfg.timeout_milsec) + mhd_DLINKEDL_DEL_D (&(d->conns.def_timeout), + c, + by_timeout); + else + mhd_DLINKEDL_DEL_D (&(d->conns.cust_timeout), \ + c, + by_timeout); +} + + MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_ void mhd_conn_update_activity_mark (struct MHD_Connection *restrict c) { @@ -186,19 +210,3 @@ mhd_conn_resumed_activity_mark (struct MHD_Connection *restrict c) else mhd_DLINKEDL_INS_FIRST_D (&(d->conns.cust_timeout), c, by_timeout); } - - -MHD_INTERNAL -MHD_FN_PAR_NONNULL_ALL_ void -mhd_conn_remove_from_timeout_lists (struct MHD_Connection *restrict c) -{ - if (mhd_D_HAS_THR_PER_CONN (c->daemon)) - return; - - if (c->connection_timeout_ms == c->daemon->conns.cfg.timeout_milsec) - mhd_DLINKEDL_DEL_D (&(c->daemon->conns.def_timeout), \ - c, by_timeout); - else - mhd_DLINKEDL_DEL_D (&(c->daemon->conns.cust_timeout), \ - c, by_timeout); -} diff --git a/src/mhd2/conn_timeout.h b/src/mhd2/conn_timeout.h @@ -77,29 +77,29 @@ MHD_FN_PAR_NONNULL_ALL_; /** - * Update last activity mark to the current time. - * @param c the connection to update + * Remove connection from time-out lists + * @param c the connection to process */ MHD_INTERNAL void -mhd_conn_update_activity_mark (struct MHD_Connection *restrict c) +mhd_conn_deinit_activity_timeout (struct MHD_Connection *restrict c) MHD_FN_PAR_NONNULL_ALL_; /** - * Update last activity mark on the resumed connection + * Update last activity mark to the current time. * @param c the connection to update */ MHD_INTERNAL void -mhd_conn_resumed_activity_mark (struct MHD_Connection *restrict c) +mhd_conn_update_activity_mark (struct MHD_Connection *restrict c) MHD_FN_PAR_NONNULL_ALL_; /** - * Remove connection from time-out lists - * @param c the connection to process + * Update last activity mark on the resumed connection + * @param c the connection to update */ MHD_INTERNAL void -mhd_conn_remove_from_timeout_lists (struct MHD_Connection *restrict c) +mhd_conn_resumed_activity_mark (struct MHD_Connection *restrict c) MHD_FN_PAR_NONNULL_ALL_; #endif /* ! MHD_CONN_TIMEOUT_H */ diff --git a/src/mhd2/daemon_add_conn.c b/src/mhd2/daemon_add_conn.c @@ -502,9 +502,7 @@ new_connection_process_inner (struct MHD_Daemon *restrict daemon, mhd_assert (MHD_SC_OK != res); notify_app_conn (daemon, connection, true); - if (! mhd_D_HAS_THR_PER_CONN (daemon)) - mhd_DLINKEDL_DEL_D (&(daemon->conns.def_timeout), \ - connection, by_timeout); + mhd_conn_deinit_activity_timeout (connection); mhd_DLINKEDL_DEL (&(daemon->conns), connection, all_conn); daemon->conns.count--; diff --git a/src/mhd2/stream_funcs.c b/src/mhd2/stream_funcs.c @@ -698,7 +698,7 @@ conn_h2_start_closing (struct MHD_Connection *restrict c, conn_start_socket_closing (c, close_hard); - mhd_conn_remove_from_timeout_lists (c); + mhd_conn_deinit_activity_timeout (c); #ifndef NDEBUG c->dbg.closing_started = true; @@ -1012,7 +1012,7 @@ mhd_conn_start_closing (struct MHD_Connection *restrict c, if (! c->suspended) { mhd_assert (! c->resuming); - mhd_conn_remove_from_timeout_lists (c); + mhd_conn_deinit_activity_timeout (c); } #ifndef NDEBUG diff --git a/src/mhd2/stream_process_states.c b/src/mhd2/stream_process_states.c @@ -643,7 +643,7 @@ mhd_conn_process_data (struct MHD_Connection *restrict c) c->event_loop_info = MHD_EVENT_LOOP_INFO_PROCESS; mhd_conn_mark_unready (c, d); - mhd_conn_remove_from_timeout_lists (c); + mhd_conn_deinit_activity_timeout (c); #ifdef mhd_DEBUG_SUSPEND_RESUME fprintf (stderr, "%%%%%% Connection suspended, FD: %2llu\n",