From 23b51bd52a0641f33f79d20fe4566a9ad3b4675b Mon Sep 17 00:00:00 2001 From: Semir Sionek Date: Fri, 13 Jun 2025 13:16:47 +0000 Subject: [PATCH] hsa: improve handling of SESSION_E_REFUSED in http client In that case (e.g trying to connect on a closed port), a connection is refused and no session is allocated. As such, we cannot use the struct to obtain the worker or vlib_main_t. Type: fix Change-Id: I9b44ccb42ba56a75b8ecc39501a7386ba2e84981 Signed-off-by: Semir Sionek --- src/plugins/hs_apps/http_client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/hs_apps/http_client.c b/src/plugins/hs_apps/http_client.c index 5787b4566bf..a284da8beb6 100644 --- a/src/plugins/hs_apps/http_client.c +++ b/src/plugins/hs_apps/http_client.c @@ -225,17 +225,17 @@ hc_session_connected_callback (u32 app_index, u32 hc_session_index, hc_session_t *hc_session; hc_http_header_t *header; - wrk = hc_worker_get (s->thread_index); - if (err) { clib_warning ("hc_session_index[%d] connected error: %U", hc_session_index, format_session_error, err); - vlib_process_signal_event_mt (wrk->vlib_main, hcm->cli_node_index, + vlib_process_signal_event_mt (vlib_get_main (), hcm->cli_node_index, HC_CONNECT_FAILED, 0); return -1; } + wrk = hc_worker_get (s->thread_index); + hc_session = hc_session_alloc (wrk); clib_spinlock_lock_if_init (&hcm->lock); hcm->connected_counter++; -- 2.16.6