From e4c18b0559da2c71a5e31a88f9165e3b492ea9d1 Mon Sep 17 00:00:00 2001 From: Bright Chen Date: Tue, 18 Feb 2025 22:31:25 +0800 Subject: [PATCH] Fix description of VersionedRefWithId --- src/brpc/socket.cpp | 4 ++-- src/brpc/versioned_ref_with_id.h | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/brpc/socket.cpp b/src/brpc/socket.cpp index ac4c6892c0..056a9fca60 100644 --- a/src/brpc/socket.cpp +++ b/src/brpc/socket.cpp @@ -960,9 +960,9 @@ std::string Socket::OnDescription() const { result.reserve(64); const int saved_fd = fd(); if (saved_fd >= 0) { - butil::string_appendf(&result, "fd=%d", saved_fd); + butil::string_appendf(&result, "fd=%d ", saved_fd); } - butil::string_appendf(&result, " addr=%s", + butil::string_appendf(&result, "addr=%s", butil::endpoint2str(remote_side()).c_str()); const int local_port = local_side().port; if (local_port > 0) { diff --git a/src/brpc/versioned_ref_with_id.h b/src/brpc/versioned_ref_with_id.h index e7c3ef8d71..20e0106d93 100644 --- a/src/brpc/versioned_ref_with_id.h +++ b/src/brpc/versioned_ref_with_id.h @@ -102,17 +102,17 @@ typename std::enable_if::value, Ret>::type ReturnEmpty() {} template \ typename std::enable_if(0))::value, return_type>::type \ - Call(class_type* obj, Args&&... args) { \ + Call(class_type* obj, Args&&... args) { \ BAIDU_CASSERT((butil::is_result_same< \ return_type, decltype(&T::func_name), T, Args...>::value), \ - "Params or return type mismatch"); \ + "Params or return type mismatch"); \ return obj->func_name(std::forward(args)...); \ } \ \ template \ typename std::enable_if(0))::value, return_type>::type \ - Call(class_type* obj, Args&&... args) { \ + Call(class_type* obj, Args&&...) { \ return ReturnEmpty(); \ } \ } @@ -356,7 +356,7 @@ int VersionedRefWithId::Create(VRefId* id, Args&&... args) { T* const t = butil::get_resource(&slot, Forbidden()); if (t == NULL) { LOG(FATAL) << "Fail to get_resource<" - << butil::class_name_str() << ">"; + << butil::class_name() << ">"; return -1; } // nref can be non-zero due to concurrent Address(). @@ -617,10 +617,10 @@ template std::string VersionedRefWithId::description() const { std::string result; result.reserve(128); - butil::string_appendf(&result, "Socket{id=%" PRIu64, id()); + butil::string_appendf(&result, "%s{id=%" PRIu64 " ", butil::class_name(), id()); result.append(WRAPPER_CALL( OnDescription, const_cast(static_cast(this)))); - butil::string_appendf(&result, "} (0x%p)", this); + butil::string_appendf(&result, "} (%p)", this); return result; }