From fda13f867d12ece4b0edffdf657da45e6c8e873f Mon Sep 17 00:00:00 2001 From: ye-qiannan Date: Fri, 12 Dec 2025 11:10:51 +0800 Subject: [PATCH] get topo bugfix --- src/ubsocket/brpc/brpc_file_descriptor.h | 14 ++++++++++++-- src/ubsocket/configure_settings.cpp | 5 +++++ src/ubsocket/configure_settings.h | 5 ----- src/ubsocket/rpc_adpt_vlog.cpp | 4 ++-- src/ubsocket/rpc_adpt_vlog.h | 2 +- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/ubsocket/brpc/brpc_file_descriptor.h b/src/ubsocket/brpc/brpc_file_descriptor.h index 02d083b..14ccb76 100644 --- a/src/ubsocket/brpc/brpc_file_descriptor.h +++ b/src/ubsocket/brpc/brpc_file_descriptor.h @@ -1562,7 +1562,6 @@ private: int GetDevRouteList(const umq_eid_t *srcEid, const umq_eid_t *dstEid, umq_route_t *connRoute) { umq_route_t route; - route.flag.bs.rtp = 1; (void)memcpy_s(&route.src, sizeof(umq_eid_t), srcEid, sizeof(umq_eid_t)); (void)memcpy_s(&route.dst, sizeof(umq_eid_t), dstEid, sizeof(umq_eid_t)); @@ -1578,7 +1577,18 @@ private: return -1; } - *connRoute = route_list.buf[0]; + for(uint32_t i = 0;i< route_list.len; ++i){ + if(route_list.buf[i].flag.bs.rtp == 1){ + *connRoute = route_list.buf[i]; + break; + } + } + + if(connRoute == nullptr){ + RPC_ADPT_VLOG_ERR("Failed to find umq dev\n"); + return -1; + } + if(mEidRegistry.IsRegisteredEid(*srcEid)) { return 0; } diff --git a/src/ubsocket/configure_settings.cpp b/src/ubsocket/configure_settings.cpp index 470aaad..03ccb37 100644 --- a/src/ubsocket/configure_settings.cpp +++ b/src/ubsocket/configure_settings.cpp @@ -78,6 +78,11 @@ ConfigSettings::socket_fd_trans_mode ConfigSettings::m_socket_fd_trans_mode = SO int ConfigSettings::ParseEnvVars() { m_log_level = util_vlog_level_converter_from_str(m_log_level_str,UTIL_VLOG_LEVEL_INFO); + if(m_log_use_printf){ + if (RpcAdptSetLogCtx(m_log_level) != UMQ_SUCCESS) { + RPC_ADPT_VLOG_WARN("Log output via printf is disabled; messages will be sent to syslog.\n"); + } + } RpcAdptVlogCtxSet(m_log_level,nullptr); RPC_ADPT_VLOG_INFO("%s: %s (input: %s)\n", ENV_VAR_LOG_LEVEL, util_vlog_level_converter_to_str(m_log_level), strlen(m_log_level_str) > 0 ? m_log_level_str : "(null)"); diff --git a/src/ubsocket/configure_settings.h b/src/ubsocket/configure_settings.h index afee256..fe191b4 100644 --- a/src/ubsocket/configure_settings.h +++ b/src/ubsocket/configure_settings.h @@ -227,11 +227,6 @@ protected: if ((env_ptr = getenv(ENV_LOG_USE_PRINTF)) != NULL) { uint32_t use_printf = static_cast(atoi(env_ptr)); m_log_use_printf = use_printf != 0; - if(m_log_use_printf){ - if (RpcAdptSetLogCtx() != UMQ_SUCCESS) { - RPC_ADPT_VLOG_WARN("Log output via printf is disabled; messages will be sent to syslog.\n"); - } - } } if((env_ptr = getenv(ENV_VAR_LOG_LEVEL)) != NULL){ diff --git a/src/ubsocket/rpc_adpt_vlog.cpp b/src/ubsocket/rpc_adpt_vlog.cpp index 2cd669b..95f7393 100644 --- a/src/ubsocket/rpc_adpt_vlog.cpp +++ b/src/ubsocket/rpc_adpt_vlog.cpp @@ -36,14 +36,14 @@ static void DefaultPrintfOutput(int level, char *logMsg) time.tm_min, time.tm_sec, (long)tval.tv_usec, g_log_level_to_str[level], logMsg); } -int RpcAdptSetLogCtx() +int RpcAdptSetLogCtx(util_vlog_level_t level) { g_rpc_adpt_vlog_ctx.vlog_output_func = DefaultPrintfOutput; umq_log_config_t log_cfg = { .log_flag = UMQ_LOG_FLAG_FUNC | UMQ_LOG_FLAG_LEVEL, .func = DefaultPrintfOutput, - .level = UMQ_LOG_LEVEL_DEBUG + .level = static_cast(level) }; int ret = umq_log_config_set(&log_cfg); diff --git a/src/ubsocket/rpc_adpt_vlog.h b/src/ubsocket/rpc_adpt_vlog.h index 8873371..39633ab 100644 --- a/src/ubsocket/rpc_adpt_vlog.h +++ b/src/ubsocket/rpc_adpt_vlog.h @@ -27,7 +27,7 @@ util_vlog_ctx_t *RpcAdptGetLogCtx(void); -int RpcAdptSetLogCtx(); +int RpcAdptSetLogCtx(util_vlog_level_t level); static ALWAYS_INLINE void RpcAdptVlogCtxSet(util_vlog_level_t level, char *vlog_name) { -- Gitee