Skip to content

Commit

Permalink
STRAND WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Apr 1, 2024
1 parent 5bbb0cb commit 00aa3f1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions nano/node/transport/tcp_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,16 +331,15 @@ auto nano::transport::tcp_listener::connect_impl (nano::tcp_endpoint endpoint) -

asio::ip::tcp::socket nano::transport::tcp_listener::accept_socket ()
{
// This expects the result type to be default-constructible, therefore we need to wrap the socket in an optional
auto future = asio::co_spawn (
strand, [this] () -> asio::awaitable<asio::ip::tcp::socket> {
strand, [this] () mutable -> asio::awaitable<std::optional<asio::ip::tcp::socket>> {
auto socket = co_await acceptor.async_accept (asio::use_awaitable);
co_return socket;
// asio::ip::tcp::socket socket{ node.io_ctx };
// co_return std::move(socket);
},
asio::use_future);
future.wait ();
return future.get ();
return future.get ().value ();
}

auto nano::transport::tcp_listener::accept_one (asio::ip::tcp::socket raw_socket, connection_type type) -> accept_result
Expand Down

0 comments on commit 00aa3f1

Please sign in to comment.