代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 47ab261c2b533975a59b34f06da0ccf83692bb78 Mon Sep 17 00:00:00 2001
From: compile_success <980965867@qq.com>
Date: Tue, 26 Dec 2023 16:53:58 +0000
Subject: [PATCH] use default nonblock mode
---
src/lstack/core/lstack_cfg.c | 12 ++++++++++++
src/lstack/core/lstack_protocol_stack.c | 5 ++++-
src/lstack/include/lstack_cfg.h | 1 +
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index a292070..d9c23fb 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -80,6 +80,7 @@ static int32_t parse_nic_rxqueue_size(void);
static int32_t parse_nic_txqueue_size(void);
static int32_t parse_stack_thread_mode(void);
static int32_t parse_nic_vlan_mode(void);
+static int32_t parse_defaule_nonblock_mode(void);
#define PARSE_ARG(_arg, _arg_string, _default_val, _min_val, _max_val, _ret) \
do { \
@@ -142,6 +143,7 @@ static struct config_vector_t g_config_tbl[] = {
{ "nic_txqueue_size", parse_nic_txqueue_size},
{ "stack_thread_mode", parse_stack_thread_mode },
{ "nic_vlan_mode", parse_nic_vlan_mode },
+ { "nonblock_mode", parse_defaule_nonblock_mode },
{ NULL, NULL }
};
@@ -1280,3 +1282,13 @@ static int32_t parse_nic_vlan_mode(void)
return ret;
}
+static int32_t parse_defaule_nonblock_mode(void)
+{
+ int32_t ret;
+ PARSE_ARG(g_config_params.nonblock_mode, "nonblock_mode", 1, 0, 1, ret);
+ if (ret != 0) {
+ LSTACK_PRE_LOG(LSTACK_ERR, "cfg: invalid nonblock mode value %d. only support 0 or 1\n", \
+ g_config_params.nonblock_mode);
+ }
+ return ret;
+}
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 9158d20..a000224 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -1287,7 +1287,10 @@ int32_t stack_broadcast_accept4(int32_t fd, struct sockaddr *addr, socklen_t *ad
int32_t stack_broadcast_accept(int32_t fd, struct sockaddr *addr, socklen_t *addrlen)
{
- return stack_broadcast_accept4(fd, addr, addrlen, 0);
+ if (get_global_cfg_params()->nonblock_mode)
+ return stack_broadcast_accept4(fd, addr, addrlen, O_NONBLOCK);
+ else
+ return stack_broadcast_accept4(fd, addr, addrlen, 0);
}
static void stack_all_fds_close(void)
diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h
index a6bdfd5..82e96d8 100644
--- a/src/lstack/include/lstack_cfg.h
+++ b/src/lstack/include/lstack_cfg.h
@@ -118,6 +118,7 @@ struct cfg_params {
bool udp_enable;
struct cfg_nic_params nic;
bool stack_mode_rtc;
+ bool nonblock_mode;
};
struct cfg_params *get_global_cfg_params(void);
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。