diff --git a/include/cserver/engine/network.hpp b/include/cserver/engine/network.hpp index 92cc746..33713ce 100644 --- a/include/cserver/engine/network.hpp +++ b/include/cserver/engine/network.hpp @@ -114,24 +114,24 @@ inline constexpr auto DynamicBuffer(T&& arg) -> decltype(boost::asio::dynamic_bu }; -template -inline constexpr auto AsyncWrite(TcpSocket& socket, Buffer buffer) -> Task<> { - return boost::asio::async_write(socket.impl, std::move(buffer), boost::asio::use_awaitable); +template +inline constexpr auto AsyncWrite(Socket&& socket, Buffer buffer) -> Task<> { + return boost::asio::async_write(std::forward(socket).impl, std::move(buffer), boost::asio::use_awaitable); }; -template -inline constexpr auto AsyncWrite(TcpSocket& socket, Buffer buffer, CompletionCondition completion) -> Task<> { - return boost::asio::async_write(socket.impl, std::move(buffer), std::move(completion), boost::asio::use_awaitable); +template +inline constexpr auto AsyncWrite(Socket&& socket, Buffer buffer, CompletionCondition completion) -> Task<> { + return boost::asio::async_write(std::forward(socket).impl, std::move(buffer), std::move(completion), boost::asio::use_awaitable); }; -template -inline constexpr auto AsyncRead(TcpSocket& socket, Buffer buffer) -> Task<> { - return boost::asio::async_read(socket.impl, std::move(buffer), boost::asio::use_awaitable); +template +inline constexpr auto AsyncRead(Socket&& socket, Buffer buffer) -> Task<> { + return boost::asio::async_read(std::forward(socket).impl, std::move(buffer), boost::asio::use_awaitable); }; -template -inline constexpr auto AsyncRead(TcpSocket& socket, Buffer buffer, CompletionCondition completion) -> Task<> { - return boost::asio::async_read(socket.impl, std::move(buffer), std::move(completion), boost::asio::use_awaitable); +template +inline constexpr auto AsyncRead(Socket&& socket, Buffer buffer, CompletionCondition completion) -> Task<> { + return boost::asio::async_read(std::forward(socket).impl, std::move(buffer), std::move(completion), boost::asio::use_awaitable); }; template