From: Florin Coras Date: Sat, 5 Apr 2025 19:41:05 +0000 (-0400) Subject: http: handle ts closed notifications X-Git-Tag: v25.10-rc0~117 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=46135069a2cc9ee48eaf4d941c053547100303c3;p=vpp.git http: handle ts closed notifications Handle transport closed notifications and update connection state. Also, handle closed state in app close notifications and force http connection cleanup if transport is already closed to avoid waiting for timer based cleanups. Type: improvement Change-Id: I26ee6a15b0993810d5a75fa56bb24e3396962f7b Signed-off-by: Florin Coras --- diff --git a/src/plugins/http/http.c b/src/plugins/http/http.c index 43b0993e462..1099f9eee8d 100644 --- a/src/plugins/http/http.c +++ b/src/plugins/http/http.c @@ -595,6 +595,19 @@ http_ts_builtin_tx_callback (session_t *ts) return 0; } +static void +http_ts_closed_callback (session_t *ts) +{ + http_conn_handle_t hc_handle; + http_conn_t *hc; + + hc_handle.as_u32 = ts->opaque; + hc = http_conn_get_w_thread (hc_handle.conn_index, ts->thread_index); + + http_disconnect_transport (hc); + hc->state = HTTP_CONN_STATE_CLOSED; +} + static void http_ts_cleanup_callback (session_t *ts, session_cleanup_ntf_t ntf) { @@ -648,6 +661,7 @@ static session_cb_vft_t http_app_cb_vft = { .session_disconnect_callback = http_ts_disconnect_callback, .session_connected_callback = http_ts_connected_callback, .session_reset_callback = http_ts_reset_callback, + .session_transport_closed_callback = http_ts_closed_callback, .session_cleanup_callback = http_ts_cleanup_callback, .half_open_cleanup_callback = http_ts_ho_cleanup_callback, .add_segment_callback = http_add_segment_callback, diff --git a/src/plugins/http/http1.c b/src/plugins/http/http1.c index 265f6e7b24f..09d69f57bdf 100644 --- a/src/plugins/http/http1.c +++ b/src/plugins/http/http1.c @@ -1807,7 +1807,7 @@ http1_app_close_callback (http_conn_t *hc, u32 req_index, u32 thread_index) return; } /* Nothing more to send, confirm close */ - if (!http_io_as_max_read (req)) + if (!http_io_as_max_read (req) || hc->state == HTTP_CONN_STATE_CLOSED) { HTTP_DBG (1, "nothing more to send, confirm close"); session_transport_closed_notify (&req->connection);