diff --git a/src/ubsocket/brpc/brpc_context.h b/src/ubsocket/brpc/brpc_context.h index 0338717d0db6809490648607f6be60d075cb0aff..ddc11e3a2d4c65e4eefbc237ddcb3ec375f627c0 100644 --- a/src/ubsocket/brpc/brpc_context.h +++ b/src/ubsocket/brpc/brpc_context.h @@ -42,7 +42,7 @@ class Context : public Brpc::ConfigSettings { } ::SocketFd *CreateSocketFd(int fd); - ::SocketFd *Context::CreateSocketFd(int fd, int event_fd); + ::SocketFd *CreateSocketFd(int fd, int event_fd); ::EpollFd *CreateEpollFd(int fd); static ALWAYS_INLINE int FetchAdd(void) diff --git a/src/ubsocket/brpc/brpc_file_descriptor.h b/src/ubsocket/brpc/brpc_file_descriptor.h index cc8be8cd000826d23b0eb0e2e5588fbcca4c8850..bd991a8e528784b234054e219f4067494ef6f95a 100644 --- a/src/ubsocket/brpc/brpc_file_descriptor.h +++ b/src/ubsocket/brpc/brpc_file_descriptor.h @@ -744,7 +744,7 @@ public: RPC_ADPT_VLOG_DEBUG("Post RX depth: %u\n", cur_post_rx_num); } while ((left_post_rx_num -= cur_post_rx_num) > 0); - int poll_cnt = 0; + uint32_t poll_cnt = 0; do { PollTx(m_tx.m_retrieve_threshold); if (umq_state_get(m_local_umqh) != QUEUE_STATE_IDLE) { diff --git a/src/ubsocket/rpc_adpt_vlog.cpp b/src/ubsocket/rpc_adpt_vlog.cpp index cf45a4dbe31806d5219a04d35d2efadaf7919e46..b0ecc61689f6980a3b0d4c069d7e8a99fcc97820 100644 --- a/src/ubsocket/rpc_adpt_vlog.cpp +++ b/src/ubsocket/rpc_adpt_vlog.cpp @@ -6,32 +6,21 @@ *Note: *History: 2025-07-28 */ -#include -#include "securec.h" #include "rpc_adpt_vlog.h" -static util_vlog_ctx_t *g_rpc_adpt_vlog_ctx = nullptr; -static std::mutex g_mutex; -const char g_vlog_name[] = "RPC_ADPT"; +static util_vlog_ctx_t g_rpc_adpt_vlog_ctx = { + .level = UTIL_VLOG_LEVEL_INFO, + .vlog_name = "RPC_ADPT", + .vlog_output_func = default_vlog_output, + .rate_limited = { + .interval_ms = UTIL_VLOG_PRINT_PERIOD_MS, + .num = UTIL_VLOG_PRINT_TIMES, + } +}; util_vlog_ctx_t *RpcAdptGetLogCtx(void) { - if (g_rpc_adpt_vlog_ctx == nullptr) { - std::lock_guard lock(g_mutex); - if (g_rpc_adpt_vlog_ctx == nullptr) { - g_rpc_adpt_vlog_ctx = new (std::nothrow) util_vlog_ctx_t(); - if (g_rpc_adpt_vlog_ctx == nullptr) { - return nullptr; - } - g_rpc_adpt_vlog_ctx->level = UTIL_VLOG_LEVEL_INFO; - if ((memcpy_s(g_rpc_adpt_vlog_ctx->vlog_name, UTIL_VLOG_NAME_STR_LEN, g_vlog_name, strlen(g_vlog_name)) != 0)) { - return nullptr; - } - g_rpc_adpt_vlog_ctx->vlog_output_func = default_vlog_output; - g_rpc_adpt_vlog_ctx->rate_limited.interval_ms = UTIL_VLOG_PRINT_PERIOD_MS; - g_rpc_adpt_vlog_ctx->rate_limited.num = UTIL_VLOG_PRINT_TIMES; - } - } - return g_rpc_adpt_vlog_ctx; + return &g_rpc_adpt_vlog_ctx; } +