From ac2caf27877b34c9802413fcd120f72f78da211a Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 12 Dec 2016 14:45:37 -0500 Subject: [PATCH] make sure all incoming data gets sent before closing a socket --- Streaming.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Streaming.h b/Streaming.h index 65a8d8b4..bf19f92a 100644 --- a/Streaming.h +++ b/Streaming.h @@ -285,7 +285,7 @@ namespace stream auto s = shared_from_this(); m_Service.post ([=](void) { - if (!m_ReceiveQueue.empty () || m_Status == eStreamStatusReset) + if (!m_ReceiveQueue.empty () || m_Status == eStreamStatusReset || m_Status == eStreamStatusClosed) s->HandleReceiveTimer (boost::asio::error::make_error_code (boost::asio::error::operation_aborted), buffer, handler, 0); else { @@ -306,7 +306,7 @@ namespace stream else if (ecode == boost::asio::error::operation_aborted) { // timeout not expired - if (m_Status == eStreamStatusReset) + if (m_Status == eStreamStatusReset || m_Status == eStreamStatusClosed) handler (boost::asio::error::make_error_code (boost::asio::error::connection_reset), 0); else handler (boost::asio::error::make_error_code (boost::asio::error::operation_aborted), 0);