http: http_app_worker_rx_notify improvement 32/42832/2
authorMatus Fabian <[email protected]>
Thu, 17 Apr 2025 08:45:54 +0000 (04:45 -0400)
committerFlorin Coras <[email protected]>
Fri, 18 Apr 2025 05:27:40 +0000 (05:27 +0000)
Do not send rx event to app worker if there is already pending one

Type: improvement

Change-Id: I76c7e222ba13932be2079b5135ffadf5c98155e7
Signed-off-by: Matus Fabian <[email protected]>
src/plugins/http/http_private.h
src/plugins/http_static/static_server.c

index cee60a4..45faece 100644 (file)
@@ -449,9 +449,15 @@ http_app_worker_rx_notify (http_req_t *req)
   app_worker_t *app_wrk;
 
   as = session_get_from_handle (req->hr_pa_session_handle);
-  app_wrk = app_worker_get_if_valid (as->app_wrk_index);
-  if (app_wrk)
-    app_worker_rx_notify (app_wrk, as);
+  if (!(as->flags & SESSION_F_RX_EVT))
+    {
+      app_wrk = app_worker_get_if_valid (as->app_wrk_index);
+      if (app_wrk)
+       {
+         as->flags |= SESSION_F_RX_EVT;
+         app_worker_rx_notify (app_wrk, as);
+       }
+    }
 }
 
 /**
@@ -574,9 +580,9 @@ always_inline void
 http_io_as_write (http_req_t *req, u8 *data, u32 len)
 {
   int n_written;
-  session_t *ts = session_get_from_handle (req->hr_pa_session_handle);
+  session_t *as = session_get_from_handle (req->hr_pa_session_handle);
 
-  n_written = svm_fifo_enqueue (ts->tx_fifo, len, data);
+  n_written = svm_fifo_enqueue (as->rx_fifo, len, data);
   ASSERT (n_written == len);
 }
 
index 4478fa4..9914bec 100644 (file)
@@ -611,7 +611,7 @@ url_handler_wait_body (hss_session_t *hs, session_t *ts)
   if (svm_fifo_max_dequeue (ts->rx_fifo) < hs->left_recv)
     {
       clib_warning ("not all data in fifo, max deq %u, left recv %u",
-                   ts->rx_fifo, hs->left_recv);
+                   svm_fifo_max_dequeue (ts->rx_fifo), hs->left_recv);
       hs->left_recv = 0;
       start_send_data (hs, HTTP_STATUS_INTERNAL_ERROR);
       hss_session_disconnect_transport (hs);