summaryrefslogtreecommitdiffstats
path: root/src/plugins/http
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2024-07-02 04:34:54 -0700
committerDave Barach <vpp@barachs.net>2024-07-08 16:27:06 +0000
commit75e8e1e948da182dbf4f6b3394f1b7fc44c1403a (patch)
treef35ad5134743fda3ac732bb5f7d3945e5005ac28 /src/plugins/http
parent6df9f442277603d3ebd3bcf950f7dd0d28fb42f5 (diff)
session: improve enable and disable handling
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3c79d16f6a19767d990e8a4683c296219b559ccd
Diffstat (limited to 'src/plugins/http')
-rw-r--r--src/plugins/http/http.c8
-rw-r--r--src/plugins/http/http.h1
-rw-r--r--src/plugins/http/http_timer.c4
3 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/http/http.c b/src/plugins/http/http.c
index 22aaaeb59b5..c5e2cc1df7d 100644
--- a/src/plugins/http/http.c
+++ b/src/plugins/http/http.c
@@ -1392,8 +1392,6 @@ http_transport_enable (vlib_main_t *vm, u8 is_en)
return 0;
}
- vec_validate (hm->wrk, vlib_num_workers ());
-
clib_memset (a, 0, sizeof (*a));
clib_memset (options, 0, sizeof (options));
@@ -1415,10 +1413,16 @@ http_transport_enable (vlib_main_t *vm, u8 is_en)
hm->app_index = a->app_index;
vec_free (a->name);
+ if (hm->is_init)
+ return 0;
+
+ vec_validate (hm->wrk, vlib_num_workers ());
+
clib_timebase_init (&hm->timebase, 0 /* GMT */, CLIB_TIMEBASE_DAYLIGHT_NONE,
&vm->clib_time /* share the system clock */);
http_timers_init (vm, http_conn_timeout_cb);
+ hm->is_init = 1;
return 0;
}
diff --git a/src/plugins/http/http.h b/src/plugins/http/http.h
index e3ee93b6291..debdebcf050 100644
--- a/src/plugins/http/http.h
+++ b/src/plugins/http/http.h
@@ -369,6 +369,7 @@ typedef struct http_main_
* Runtime config
*/
u8 debug_level;
+ u8 is_init;
/*
* Config
diff --git a/src/plugins/http/http_timer.c b/src/plugins/http/http_timer.c
index c8fc6328855..5ee8efc8551 100644
--- a/src/plugins/http/http_timer.c
+++ b/src/plugins/http/http_timer.c
@@ -71,8 +71,8 @@ http_timers_init (vlib_main_t *vm, http_conn_timeout_fn *cb_fn)
http_tw_ctx_t *twc = &http_tw_ctx;
vlib_node_t *n;
- if (twc->tw.timers)
- return;
+ ASSERT (twc->tw.timers == 0);
+
tw_timer_wheel_init_2t_1w_2048sl (&twc->tw, http_timer_process_expired_cb,
1.0 /* timer interval */, ~0);
clib_spinlock_init (&twc->tw_lock);