6 Star 0 Fork 7

src-openEuler/booth

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Refactor-Add-a-function-to-convert-a-BOOTH_DAEMON_ST.patch 1.16 KB
一键复制 编辑 原始数据 按行查看 历史
bizhiyuan 提交于 2024-10-24 20:22 +08:00 . Apply setup_udp_server refactorings
From 66c276300c95238fe9bb59e61b3e6de30db07f6f Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Thu, 15 Aug 2024 13:47:07 -0400
Subject: [PATCH 42/50] Refactor: Add a function to convert a
BOOTH_DAEMON_STATE to a string.
---
src/main.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/main.c b/src/main.c
index c6f6bb6..013a5a3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -120,6 +120,17 @@ static int sig_exit_handler_sig = 0;
static int sig_usr1_handler_called = 0;
static int sig_chld_handler_called = 0;
+static const char *state_string(BOOTH_DAEMON_STATE st)
+{
+ if (st == BOOTHD_STARTED) {
+ return "started";
+ } else if (st == BOOTHD_STARTING) {
+ return "starting";
+ } else {
+ return "invalid";
+ }
+}
+
static void client_alloc(void)
{
int i;
@@ -455,9 +466,7 @@ static int write_daemon_state(int fd, int state)
"booth_addr_string='%s' "
"booth_port=%d\n",
getpid(),
- ( state == BOOTHD_STARTED ? "started" :
- state == BOOTHD_STARTING ? "starting" :
- "invalid"),
+ state_string(state),
type_to_string(local->type),
booth_conf->name,
local->site_id,
--
2.25.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/booth.git
git@gitee.com:src-openeuler/booth.git
src-openeuler
booth
booth
master

搜索帮助