From d3552eafaca34771734258f3ff6f4f5f819e72bd Mon Sep 17 00:00:00 2001 From: Xavier Simonart Date: Wed, 4 Sep 2019 13:54:31 +0200 Subject: Add heartbeat support (stop all cores in case of TCP socket issues) "heartbeat timeout" (in second) can be specified as a global parameter in PROX config file. If set, a timer is started when the first command is received from the TCP socket. This timer is reset at each commands received through the TCP socket. If the timer expires, then - all cores are stopped - the TCP socket is closed, causing an error at client side. This feature helps in case a script starts PROX and the traffic generated through PROX causes issues to the control plane. Change-Id: I900f22fa091786a564f6b7d846f5abc2c5cbcc58 Signed-off-by: Xavier Simonart --- VNFs/DPPD-PROX/run.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'VNFs/DPPD-PROX/run.c') diff --git a/VNFs/DPPD-PROX/run.c b/VNFs/DPPD-PROX/run.c index bed0c757..c05f0a9f 100644 --- a/VNFs/DPPD-PROX/run.c +++ b/VNFs/DPPD-PROX/run.c @@ -237,6 +237,13 @@ void __attribute__((noreturn)) run(uint32_t flags) if (stop_tsc && rte_rdtsc() >= stop_tsc) { stop_prox = 1; } + if ((prox_cfg.heartbeat_tsc) && (prox_cfg.heartbeat_timeout) && (rte_rdtsc() >= prox_cfg.heartbeat_tsc)) { + plog_info("Stopping to handle client as heartbeat timed out\n"); + stop_core_all(-1); + stop_handling_client(); + req_refresh(); + prox_cfg.heartbeat_tsc = 0; + } } } else { while (stop_prox == 0) { @@ -254,6 +261,13 @@ void __attribute__((noreturn)) run(uint32_t flags) if (stop_tsc && rte_rdtsc() >= stop_tsc) { stop_prox = 1; } + if ((prox_cfg.heartbeat_tsc) && (prox_cfg.heartbeat_timeout) && (rte_rdtsc() >= prox_cfg.heartbeat_tsc)) { + plog_info("Stopping to handle client as heartbeat timed out\n"); + stop_core_all(-1); + stop_handling_client(); + req_refresh(); + prox_cfg.heartbeat_tsc = 0; + } } } -- cgit 1.2.3-korg