/v1/events: terminate on disconnect

This commit is contained in:
Alexander A. Klimov 2019-04-03 09:59:45 +02:00
parent 4c5ee0dbbf
commit 2e5af2922b
3 changed files with 9 additions and 0 deletions

View File

@ -117,6 +117,8 @@ bool EventsHandler::HandleRequest(
asio::async_write(stream, payload, yc); asio::async_write(stream, payload, yc);
asio::async_write(stream, newLine, yc); asio::async_write(stream, newLine, yc);
stream.async_flush(yc); stream.async_flush(yc);
} else if (server.Disconnected()) {
return true;
} }
} }
} }

View File

@ -114,6 +114,11 @@ void HttpServerConnection::StartStreaming()
}); });
} }
bool HttpServerConnection::Disconnected()
{
return m_ShuttingDown;
}
static inline static inline
bool EnsureValidHeaders( bool EnsureValidHeaders(
AsioTlsStream& stream, AsioTlsStream& stream,

View File

@ -29,6 +29,8 @@ public:
void Disconnect(); void Disconnect();
void StartStreaming(); void StartStreaming();
bool Disconnected();
private: private:
ApiUser::Ptr m_ApiUser; ApiUser::Ptr m_ApiUser;
std::shared_ptr<AsioTlsStream> m_Stream; std::shared_ptr<AsioTlsStream> m_Stream;