mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
HttpServerConnection#StartStreaming(): auto-detect disconnection
This commit is contained in:
parent
c284cf0b68
commit
28d46052b0
@ -93,7 +93,25 @@ void HttpServerConnection::Disconnect()
|
|||||||
|
|
||||||
void HttpServerConnection::StartStreaming()
|
void HttpServerConnection::StartStreaming()
|
||||||
{
|
{
|
||||||
|
namespace asio = boost::asio;
|
||||||
|
|
||||||
m_HasStartedStreaming = true;
|
m_HasStartedStreaming = true;
|
||||||
|
|
||||||
|
HttpServerConnection::Ptr keepAlive (this);
|
||||||
|
|
||||||
|
asio::spawn(m_IoStrand, [this, keepAlive](asio::yield_context yc) {
|
||||||
|
if (!m_ShuttingDown) {
|
||||||
|
char buf[128];
|
||||||
|
asio::mutable_buffer readBuf (buf, 128);
|
||||||
|
boost::system::error_code ec;
|
||||||
|
|
||||||
|
do {
|
||||||
|
m_Stream->async_read_some(readBuf, yc[ec]);
|
||||||
|
} while (!ec);
|
||||||
|
|
||||||
|
Disconnect();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
|
Loading…
x
Reference in New Issue
Block a user