HttpClientGetTlsNoRespBodyTest, HttpClientPostFileTest, HttpClientPostFilePtrTest, HttpUnitTest,
HttpRequestLineTest, HttpClientGetTimeout, HttpStaticFileHandlerWrkTest, HttpStaticUrlHandlerWrkTest, HttpConnTimeoutTest,
HttpClientGetRepeatTest, HttpClientPostRepeatTest, HttpIgnoreH2UpgradeTest, HttpInvalidAuthorityFormUriTest, HttpHeaderErrorConnectionDropTest,
- HttpClientInvalidHeaderNameTest, HttpStaticHttp1OnlyTest)
+ HttpClientInvalidHeaderNameTest, HttpStaticHttp1OnlyTest, HttpTimerSessionDisable)
RegisterNoTopoSoloTests(HttpStaticPromTest, HttpGetTpsTest, HttpGetTpsInterruptModeTest, PromConcurrentConnectionsTest,
PromMemLeakTest, HttpClientPostMemLeakTest, HttpInvalidClientRequestMemLeakTest, HttpPostTpsTest, HttpPostTpsInterruptModeTest,
PromConsecutiveConnectionsTest, HttpGetTpsTlsTest, HttpPostTpsTlsTest, HttpClientGetRepeatMTTest, HttpClientPtrGetRepeatMTTest)
s.AssertContains(resp, "HTTP/1.1 400 Bad Request", "'HTTP1.1' invalid http version not allowed")
}
+func HttpTimerSessionDisable(s *NoTopoSuite) {
+ vpp := s.Containers.Vpp.VppInstance
+ serverAddress := s.VppAddr() + ":" + s.Ports.Http
+ s.Log(vpp.Vppctl("http static server www-root " + wwwRootPath + " uri tcp://" + serverAddress))
+ time.Sleep(250 * time.Millisecond)
+ resp := vpp.Vppctl("show node http-timer-process")
+ s.AssertContains(resp, "node http-timer-process, type process, state \"any wait\"")
+ vpp.Vppctl("session disable")
+ time.Sleep(1 * time.Second)
+ resp = vpp.Vppctl("show node http-timer-process")
+ s.AssertContains(resp, "node http-timer-process, type process, state \"not started\"")
+ vpp.Vppctl("session enable")
+ time.Sleep(100 * time.Millisecond)
+ resp = vpp.Vppctl("show node http-timer-process")
+ s.AssertContains(resp, "node http-timer-process, type process, state \"any wait\"")
+}
+
func HttpRequestLineTest(s *NoTopoSuite) {
vpp := s.Containers.Vpp.VppInstance
serverAddress := s.VppAddr() + ":" + s.Ports.Http
da->app_index = hm->app_index;
da->api_client_index = APP_INVALID_INDEX;
vnet_application_detach (da);
+ http_timers_set_state (vm, false);
return 0;
}
vec_free (a->name);
if (hm->is_init)
- return 0;
+ {
+ http_timers_set_state (vm, true);
+ return 0;
+ }
vec_validate (hm->wrk, num_threads - 1);
vec_validate (hm->rx_bufs, num_threads - 1);
http_tw_ctx_t http_tw_ctx;
+static uword http_timer_process (vlib_main_t *vm, vlib_node_runtime_t *rt,
+ vlib_frame_t *f);
+
static void
http_timer_process_expired_cb (u32 *expired_timers)
{
}
}
+VLIB_REGISTER_NODE (http_timer_process_node) = {
+ .function = http_timer_process,
+ .type = VLIB_NODE_TYPE_PROCESS,
+ .name = "http-timer-process",
+ .state = VLIB_NODE_STATE_DISABLED,
+};
+
static uword
http_timer_process (vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
{
uword *event_data = 0;
uword __clib_unused event_type;
- while (1)
+ while (vlib_node_get_state (vm, http_timer_process_node.index) !=
+ VLIB_NODE_STATE_DISABLED)
{
vlib_process_wait_for_event_or_clock (vm, timeout);
now = vlib_time_now (vm);
return 0;
}
-VLIB_REGISTER_NODE (http_timer_process_node) = {
- .function = http_timer_process,
- .type = VLIB_NODE_TYPE_PROCESS,
- .name = "http-timer-process",
- .state = VLIB_NODE_STATE_DISABLED,
-};
+void
+http_timers_set_state (vlib_main_t *vm, bool enabled)
+{
+ vlib_node_t *n;
+
+ vlib_node_set_state (
+ vm, http_timer_process_node.index,
+ (enabled ? VLIB_NODE_STATE_POLLING : VLIB_NODE_STATE_DISABLED));
+ if (enabled)
+ {
+ n = vlib_get_node (vm, http_timer_process_node.index);
+ vlib_start_process (vm, n->runtime_index);
+ }
+}
void
http_timers_init (vlib_main_t *vm, http_conn_timeout_fn *rpc_cb,
http_conn_invalidate_timer_fn *invalidate_cb)
{
http_tw_ctx_t *twc = &http_tw_ctx;
- vlib_node_t *n;
ASSERT (twc->tw.timers == 0);
twc->rpc_cb = rpc_cb;
twc->invalidate_cb = invalidate_cb;
- vlib_node_set_state (vm, http_timer_process_node.index,
- VLIB_NODE_STATE_POLLING);
- n = vlib_get_node (vm, http_timer_process_node.index);
- vlib_start_process (vm, n->runtime_index);
+ http_timers_set_state (vm, true);
}
/*
void http_timers_init (vlib_main_t *vm, http_conn_timeout_fn *rpc_cb,
http_conn_invalidate_timer_fn *invalidate_cb);
+void http_timers_set_state (vlib_main_t *vm, bool enabled);
static inline void
http_conn_timer_start (http_conn_t *hc)