/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, newLine, 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
bool EnsureValidHeaders(
AsioTlsStream& stream,

View File

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