aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-02-19 14:30:32 -0800
committerDave Barach <openvpp@barachs.net>2022-02-23 21:24:47 +0000
commit4df1d35132fcd07a5559e63e9ac89b1a2dc2989d (patch)
tree5ffe37fce0fc8bcc62024e4790d30a07e917ed62 /src/plugins
parentf83d6668b083ca9ce502240557d8f6abd8645922 (diff)
http: improvement reset and close handling
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I37ff8099c6c8044881379b4cd47ca8843746c315
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/hs_apps/http_tps.c21
-rw-r--r--src/plugins/http/http.c23
2 files changed, 31 insertions, 13 deletions
diff --git a/src/plugins/hs_apps/http_tps.c b/src/plugins/hs_apps/http_tps.c
index 4407427e652..205e062a923 100644
--- a/src/plugins/hs_apps/http_tps.c
+++ b/src/plugins/hs_apps/http_tps.c
@@ -83,6 +83,9 @@ hts_session_free (hts_session_t *hs)
hts_main_t *htm = &hts_main;
u32 thread = hs->thread_index;
+ if (htm->debug_level > 0)
+ clib_warning ("Freeing session %u", hs->session_index);
+
if (CLIB_DEBUG)
clib_memset (hs, 0xfa, sizeof (*hs));
@@ -296,6 +299,7 @@ hs_ts_tx_callback (session_t *ts)
static int
hts_ts_accept_callback (session_t *ts)
{
+ hts_main_t *htm = &hts_main;
hts_session_t *hs;
hs = hts_session_alloc (ts->thread_index);
@@ -304,6 +308,9 @@ hts_ts_accept_callback (session_t *ts)
ts->opaque = hs->session_index;
ts->session_state = SESSION_STATE_READY;
+ if (htm->debug_level > 0)
+ clib_warning ("Accepted session %u", ts->opaque);
+
return 0;
}
@@ -316,23 +323,29 @@ hts_ts_connected_callback (u32 app_index, u32 api_context, session_t *s,
}
static void
-hts_ts_disconnect_callback (session_t *s)
+hts_ts_disconnect_callback (session_t *ts)
{
hts_main_t *htm = &hts_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
- a->handle = session_handle (s);
+ if (htm->debug_level > 0)
+ clib_warning ("Closed session %u", ts->opaque);
+
+ a->handle = session_handle (ts);
a->app_index = htm->app_index;
vnet_disconnect_session (a);
}
static void
-hts_ts_reset_callback (session_t *s)
+hts_ts_reset_callback (session_t *ts)
{
hts_main_t *htm = &hts_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
- a->handle = session_handle (s);
+ if (htm->debug_level > 0)
+ clib_warning ("Reset session %u", ts->opaque);
+
+ a->handle = session_handle (ts);
a->app_index = htm->app_index;
vnet_disconnect_session (a);
}
diff --git a/src/plugins/http/http.c b/src/plugins/http/http.c
index f1a304829ac..828e57d3640 100644
--- a/src/plugins/http/http.c
+++ b/src/plugins/http/http.c
@@ -229,6 +229,7 @@ http_ts_disconnect_callback (session_t *ts)
if (hc->state < HTTP_CONN_STATE_TRANSPORT_CLOSED)
hc->state = HTTP_CONN_STATE_TRANSPORT_CLOSED;
+ /* Nothing more to rx, propagate to app */
if (!svm_fifo_max_dequeue_cons (ts->rx_fifo))
session_transport_closing_notify (&hc->connection);
}
@@ -236,15 +237,16 @@ http_ts_disconnect_callback (session_t *ts)
static void
http_ts_reset_callback (session_t *ts)
{
- http_conn_t *ctx;
+ http_conn_t *hc;
- ctx = http_conn_get_w_thread (ts->opaque, ts->thread_index);
+ hc = http_conn_get_w_thread (ts->opaque, ts->thread_index);
- if (ctx->state < HTTP_CONN_STATE_TRANSPORT_CLOSED)
- ctx->state = HTTP_CONN_STATE_TRANSPORT_CLOSED;
+ hc->state = HTTP_CONN_STATE_CLOSED;
+ http_buffer_free (&hc->tx_buf);
+ hc->req_state = HTTP_REQ_STATE_WAIT_METHOD;
+ session_transport_reset_notify (&hc->connection);
- if (!svm_fifo_max_dequeue_cons (ts->rx_fifo))
- session_transport_reset_notify (&ctx->connection);
+ http_disconnect_transport (hc);
}
/**
@@ -856,7 +858,10 @@ http_app_tx_callback (void *session, transport_send_params_t *sp)
hc = http_conn_get_w_thread (as->connection_index, as->thread_index);
if (hc->req_state < HTTP_REQ_STATE_WAIT_APP)
{
- clib_warning ("app data in req state %u", hc->req_state);
+ if (hc->state != HTTP_CONN_STATE_CLOSED)
+ clib_warning ("app data req state %u session state %u", hc->req_state,
+ hc->state);
+ svm_fifo_dequeue_drop_all (as->tx_fifo);
return 0;
}
@@ -865,9 +870,9 @@ http_app_tx_callback (void *session, transport_send_params_t *sp)
http_req_run_state_machine (hc, sp);
- if (hc->state == HTTP_CONN_STATE_CLOSED)
+ if (hc->state == HTTP_CONN_STATE_APP_CLOSED)
{
- if (!svm_fifo_max_dequeue_cons (as->rx_fifo))
+ if (!svm_fifo_max_dequeue_cons (as->tx_fifo))
http_disconnect_transport (hc);
}