mirror of https://github.com/Icinga/icinga2.git
Fix deadlock in {HttpServerConnection,JsonRpcConnection}::DataAvailableHandler
refs #11014
This commit is contained in:
parent
c2cf614d62
commit
deac316a45
|
@ -78,6 +78,7 @@ void HttpServerConnection::Disconnect(void)
|
|||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||
listener->RemoveHttpClient(this);
|
||||
|
||||
if (!m_Stream->IsEof())
|
||||
m_Stream->Shutdown();
|
||||
}
|
||||
|
||||
|
@ -196,6 +197,9 @@ void HttpServerConnection::ProcessMessageAsync(HttpRequest& request)
|
|||
|
||||
void HttpServerConnection::DataAvailableHandler(void)
|
||||
{
|
||||
bool close = false;
|
||||
|
||||
if (!m_Stream->IsEof()) {
|
||||
boost::mutex::scoped_lock lock(m_DataHandlerMutex);
|
||||
|
||||
try {
|
||||
|
@ -205,12 +209,12 @@ void HttpServerConnection::DataAvailableHandler(void)
|
|||
Log(LogWarning, "HttpServerConnection")
|
||||
<< "Error while reading Http request: " << DiagnosticInformation(ex);
|
||||
|
||||
Disconnect();
|
||||
|
||||
return;
|
||||
close = true;
|
||||
}
|
||||
} else
|
||||
close = true;
|
||||
|
||||
if (m_Stream->IsEof())
|
||||
if (close)
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
|
|
|
@ -227,6 +227,9 @@ bool JsonRpcConnection::ProcessMessage(void)
|
|||
|
||||
void JsonRpcConnection::DataAvailableHandler(void)
|
||||
{
|
||||
bool close = false;
|
||||
|
||||
if (!m_Stream->IsEof()) {
|
||||
boost::mutex::scoped_lock lock(m_DataHandlerMutex);
|
||||
|
||||
try {
|
||||
|
@ -241,8 +244,10 @@ void JsonRpcConnection::DataAvailableHandler(void)
|
|||
|
||||
return;
|
||||
}
|
||||
} else
|
||||
close = true;
|
||||
|
||||
if (m_Stream->IsEof())
|
||||
if (close)
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue