diff --git a/include/ylt/coro_rpc/impl/coro_connection.hpp b/include/ylt/coro_rpc/impl/coro_connection.hpp index 231353752..f0be2b297 100644 --- a/include/ylt/coro_rpc/impl/coro_connection.hpp +++ b/include/ylt/coro_rpc/impl/coro_connection.hpp @@ -621,7 +621,9 @@ void context_info_t::close() { } template -uint64_t context_info_t::get_connection_id() const noexcept {} +uint64_t context_info_t::get_connection_id() const noexcept { + return conn_->get_connection_id(); +} template void context_info_t::set_response_attachment( diff --git a/include/ylt/coro_rpc/impl/protocol/coro_rpc_protocol.hpp b/include/ylt/coro_rpc/impl/protocol/coro_rpc_protocol.hpp index 9d48ee7e1..2e537a86d 100644 --- a/include/ylt/coro_rpc/impl/protocol/coro_rpc_protocol.hpp +++ b/include/ylt/coro_rpc/impl/protocol/coro_rpc_protocol.hpp @@ -219,7 +219,7 @@ async_simple::coro::Lazy*> get_context_in_coro() { } namespace detail { -template +template context_info_t*& set_context() { thread_local static context_info_t* ctx; return ctx; @@ -228,7 +228,7 @@ context_info_t*& set_context() { template context_info_t* get_context() { - return detail::set_context(); + return detail::set_context(); } } // namespace coro_rpc \ No newline at end of file diff --git a/src/coro_io/tests/test_coro_channel.cpp b/src/coro_io/tests/test_coro_channel.cpp index bdd343ebf..384ce62ee 100644 --- a/src/coro_io/tests/test_coro_channel.cpp +++ b/src/coro_io/tests/test_coro_channel.cpp @@ -6,6 +6,19 @@ #include using namespace std::chrono_literals; +#ifndef __clang__ +#ifdef __GNUC__ +#include +#if __GNUC_PREREQ(10, 3) // If gcc_version >= 10.3 +#define IS_OK +#endif +#else +#define IS_OK +#endif +#else +#define IS_OK +#endif + async_simple::coro::Lazy test_coro_channel() { auto ch = coro_io::create_channel(1000); @@ -112,6 +125,7 @@ async_simple::coro::Lazy test_select_channel() { } void callback_lazy() { +#ifdef IS_OK using namespace async_simple::coro; auto test0 = []() mutable -> Lazy { co_return 41; @@ -144,6 +158,7 @@ void callback_lazy() { CHECK(result == 83); })); CHECK(index == 0); +#endif } TEST_CASE("test channel send recieve, test select channel and coroutine") {