diff --git a/src/network/Session.cpp b/src/network/Session.cpp index 19414f3..1c68998 100644 --- a/src/network/Session.cpp +++ b/src/network/Session.cpp @@ -63,6 +63,10 @@ namespace UNO::NETWORK { auto msg = std::make_shared(message); std::array buffers = {asio::buffer(length.get(), sizeof(size_t)), asio::buffer(*msg)}; - asio::async_write(socket_, buffers, [this, self = shared_from_this(), length, msg](const asio::error_code &ec, size_t) {}); + asio::async_write(socket_, buffers, [this, self = shared_from_this(), length, msg](const asio::error_code &ec, size_t) { + if (!ec && this->messages_.empty() == false) { + this->doWrite(); + } + }); } -} // namespace UNO::NETWORK \ No newline at end of file +} // namespace UNO::NETWORK