diff --git a/include/ylt/coro_rpc/impl/context.hpp b/include/ylt/coro_rpc/impl/context.hpp index 1d1b046ae..bd29cf76c 100644 --- a/include/ylt/coro_rpc/impl/context.hpp +++ b/include/ylt/coro_rpc/impl/context.hpp @@ -149,7 +149,7 @@ class context_base { * Get the unique connection ID * @return connection id */ - uint64_t get_connection_id() { return self_->conn_->conn_id_; } + uint64_t get_connection_id() { return self_->conn_->get_connection_id(); } /*! * Set the response_attachment diff --git a/include/ylt/coro_rpc/impl/coro_connection.hpp b/include/ylt/coro_rpc/impl/coro_connection.hpp index 349d20479..5aeb52532 100644 --- a/include/ylt/coro_rpc/impl/coro_connection.hpp +++ b/include/ylt/coro_rpc/impl/coro_connection.hpp @@ -348,14 +348,14 @@ class coro_connection : public std::enable_shared_from_this { }); } - void close_coro() {} - using QuitCallback = std::function; void set_quit_callback(QuitCallback callback, uint64_t conn_id) { quit_callback_ = std::move(callback); conn_id_ = conn_id; } + uint64_t get_connection_id() const noexcept { return conn_id_; } + std::any &tag() { return tag_; } const std::any &tag() const { return tag_; } diff --git a/src/coro_rpc/tests/rpc_api.cpp b/src/coro_rpc/tests/rpc_api.cpp index eb244a434..25b84f874 100644 --- a/src/coro_rpc/tests/rpc_api.cpp +++ b/src/coro_rpc/tests/rpc_api.cpp @@ -46,6 +46,7 @@ int long_run_func(int val) { } void echo_with_attachment(coro_rpc::context conn) { + ELOGFMT(INFO, "conn ID:{}", conn.get_connection_id()); auto str = conn.release_request_attachment(); conn.set_response_attachment(std::move(str)); conn.response_msg();