代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 336703252c327d82f49d40f79b1d1e4e65a9281e Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng12@huawei.com>
Date: Tue, 19 Apr 2022 19:49:06 +0800
Subject: [PATCH 02/18] exit lstack process after ltran instance logout
close fd is to notify ltran to execute the lstack instance logout.
200ms is an empirical value of instance logout.
---
src/lstack/api/lstack_signal.c | 4 +++-
src/lstack/core/lstack_control_plane.c | 9 +++++++++
src/lstack/include/lstack_control_plane.h | 1 +
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/lstack/api/lstack_signal.c b/src/lstack/api/lstack_signal.c
index f4763e8..87cbdda 100644
--- a/src/lstack/api/lstack_signal.c
+++ b/src/lstack/api/lstack_signal.c
@@ -19,8 +19,9 @@
#include <lwip/posix_api.h>
#include "lstack_log.h"
+#include "lstack_control_plane.h"
-static int g_hijack_signal[] = { SIGTERM, SIGINT, SIGSEGV, SIGBUS, SIGFPE, SIGILL };
+static int g_hijack_signal[] = { SIGTERM, SIGINT, SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGKILL};
#define HIJACK_SIGNAL_COUNT (sizeof(g_hijack_signal) / sizeof(g_hijack_signal[0]))
#define BACKTRACE_SIZE 64
static void dump_stack(void)
@@ -54,6 +55,7 @@ static inline bool match_hijack_signal(int sig)
static void lstack_sig_default_handler(int sig)
{
LSTACK_LOG(ERR, LSTACK, "lstack dumped,caught signal:%d\n", sig);
+ control_fd_close();
dump_stack();
lwip_exit();
(void)kill(getpid(), sig);
diff --git a/src/lstack/core/lstack_control_plane.c b/src/lstack/core/lstack_control_plane.c
index c782d51..01b2ff0 100644
--- a/src/lstack/core/lstack_control_plane.c
+++ b/src/lstack/core/lstack_control_plane.c
@@ -446,6 +446,15 @@ int32_t client_reg_thrd_ring(void)
return 0;
}
+void control_fd_close(void)
+{
+ if (g_data_fd != 0) {
+ close(g_data_fd);
+ /* 200ms: wait ltran instance logout */
+ rte_delay_ms(200);
+ }
+}
+
int32_t control_init_client(bool is_reconnect)
{
int32_t ret;
diff --git a/src/lstack/include/lstack_control_plane.h b/src/lstack/include/lstack_control_plane.h
index 0af891a..1fa84e6 100644
--- a/src/lstack/include/lstack_control_plane.h
+++ b/src/lstack/include/lstack_control_plane.h
@@ -32,5 +32,6 @@ void control_server_thread(void *arg);
bool get_register_state(void);
void thread_register_phase1(struct rpc_msg *msg);
void thread_register_phase2(struct rpc_msg *msg);
+void control_fd_close(void);
#endif /* GAZELLE_CONTROL_PLANE_H */
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。