From 00aa3f1ee94d098996e523a7e0555b5c78f7df9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Mon, 1 Apr 2024 16:11:35 +0200 Subject: [PATCH] STRAND WIP --- nano/node/transport/tcp_listener.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nano/node/transport/tcp_listener.cpp b/nano/node/transport/tcp_listener.cpp index 2c62dedf10..0626657167 100644 --- a/nano/node/transport/tcp_listener.cpp +++ b/nano/node/transport/tcp_listener.cpp @@ -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 { + strand, [this] () mutable -> asio::awaitable> { 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