template void SocketBase::HandleReadSome(const boost::system::error_code& ec, size_t size) { if(ec) { // Silently ignore aborts (socket closed, ...) if(ec == boost::asio::error::operation_aborted || ec == boost::asio::error::bad_descriptor) return; if(ec == boost::asio::error::eof || ec == boost::asio::error::connection_reset) { OnRemoteDisconnect(); } else { SPDLOG_ERROR("Failed to read with {0}", ec.message()); } Disconnect(); return; } m_recvFillSize += size; const auto processed = ProcessData(boost::asio::buffer(m_recvBuffer, m_recvFillSize)); // If the socket was closed, abort if(!m_socket.is_open()) return; // Now that we have the chance, compact the recv buffer. if(processed != 0) { STORM_ASSERT(processed <= m_recvFillSize, "Buffer overflow"); m_recvBuffer.erase(m_recvBuffer.begin(), m_recvBuffer.begin() + processed); m_recvFillSize -= processed; } // Unconditionally start receiving data again StartReadSome(); }