Skip to content

Commit

Permalink
fix compile
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle committed Apr 3, 2024
1 parent 720f969 commit f89622f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 3 additions & 1 deletion include/ylt/coro_rpc/impl/coro_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,9 @@ void context_info_t<rpc_protocol>::close() {
}

template <typename rpc_protocol>
uint64_t context_info_t<rpc_protocol>::get_connection_id() const noexcept {}
uint64_t context_info_t<rpc_protocol>::get_connection_id() const noexcept {
return conn_->get_connection_id();
}

template <typename rpc_protocol>
void context_info_t<rpc_protocol>::set_response_attachment(
Expand Down
4 changes: 2 additions & 2 deletions include/ylt/coro_rpc/impl/protocol/coro_rpc_protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ async_simple::coro::Lazy<context_info_t<rpc_protocol>*> get_context_in_coro() {
}

namespace detail {
template <typename rpc_protocol = coro_rpc::protocol::coro_rpc_protocol>
template <typename rpc_protocol>
context_info_t<rpc_protocol>*& set_context() {
thread_local static context_info_t<rpc_protocol>* ctx;
return ctx;
Expand All @@ -228,7 +228,7 @@ context_info_t<rpc_protocol>*& set_context() {

template <typename rpc_protocol = coro_rpc::protocol::coro_rpc_protocol>
context_info_t<rpc_protocol>* get_context() {
return detail::set_context();
return detail::set_context<rpc_protocol>();
}

} // namespace coro_rpc
15 changes: 15 additions & 0 deletions src/coro_io/tests/test_coro_channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
#include <ylt/coro_io/coro_io.hpp>
using namespace std::chrono_literals;

#ifndef __clang__
#ifdef __GNUC__
#include <features.h>
#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<void> test_coro_channel() {
auto ch = coro_io::create_channel<int>(1000);

Expand Down Expand Up @@ -112,6 +125,7 @@ async_simple::coro::Lazy<void> test_select_channel() {
}

void callback_lazy() {
#ifdef IS_OK
using namespace async_simple::coro;
auto test0 = []() mutable -> Lazy<int> {
co_return 41;
Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit f89622f

Please sign in to comment.