From 207022a6bb5438fd556b2681c46ff23b15567dfd Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 21 Jul 2014 14:28:17 -0400 Subject: [PATCH] throw connection_reset error is stream is closed --- HTTPServer.cpp | 4 ++-- Streaming.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/HTTPServer.cpp b/HTTPServer.cpp index 7057cb46..a66a394f 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -416,9 +416,9 @@ namespace util } else { - if (m_Stream && m_Stream->IsOpen ()) + if (ecode == boost::asio::error::timed_out) SendReply ("" + itoopieImage + "
Not responding", 504); - else + else Terminate (); } } diff --git a/Streaming.h b/Streaming.h index 41315add..89e378b2 100644 --- a/Streaming.h +++ b/Streaming.h @@ -213,6 +213,11 @@ namespace stream return; } } + if (!m_IsOpen) + { + handler (boost::asio::error::make_error_code (boost::asio::error::connection_reset), 0); + return; + } m_ReceiveTimer.expires_from_now (boost::posix_time::seconds(timeout)); m_ReceiveTimer.async_wait ([=](const boost::system::error_code& ecode) { this->HandleReceiveTimer (ecode, buffer, handler); });