mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 16:14:09 +02:00
parent
3e342015c9
commit
905de04293
@ -92,7 +92,8 @@ ConnectionRole JsonRpcConnection::GetRole(void) const
|
|||||||
|
|
||||||
void JsonRpcConnection::SendMessage(const Dictionary::Ptr& message)
|
void JsonRpcConnection::SendMessage(const Dictionary::Ptr& message)
|
||||||
{
|
{
|
||||||
m_WriteQueue.Enqueue(boost::bind(&JsonRpcConnection::SendMessageSync, JsonRpcConnection::Ptr(this), message), true);
|
if (!m_Stream->IsEof())
|
||||||
|
m_WriteQueue.Enqueue(boost::bind(&JsonRpcConnection::SendMessageSync, JsonRpcConnection::Ptr(this), message), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonRpcConnection::SendMessageSync(const Dictionary::Ptr& message)
|
void JsonRpcConnection::SendMessageSync(const Dictionary::Ptr& message)
|
||||||
@ -108,7 +109,7 @@ void JsonRpcConnection::SendMessageSync(const Dictionary::Ptr& message)
|
|||||||
Log(LogWarning, "JsonRpcConnection")
|
Log(LogWarning, "JsonRpcConnection")
|
||||||
<< info.str() << "\n" << DiagnosticInformation(ex);
|
<< info.str() << "\n" << DiagnosticInformation(ex);
|
||||||
|
|
||||||
Disconnect();
|
Utility::QueueAsyncCallback(boost::bind(&JsonRpcConnection::Disconnect, JsonRpcConnection::Ptr(this)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,14 +118,16 @@ void JsonRpcConnection::Disconnect(void)
|
|||||||
Log(LogWarning, "JsonRpcConnection")
|
Log(LogWarning, "JsonRpcConnection")
|
||||||
<< "API client disconnected for identity '" << m_Identity << "'";
|
<< "API client disconnected for identity '" << m_Identity << "'";
|
||||||
|
|
||||||
|
m_Stream->Close();
|
||||||
|
|
||||||
|
m_WriteQueue.Join();
|
||||||
|
|
||||||
if (m_Endpoint)
|
if (m_Endpoint)
|
||||||
m_Endpoint->RemoveClient(this);
|
m_Endpoint->RemoveClient(this);
|
||||||
else {
|
else {
|
||||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||||
listener->RemoveAnonymousClient(this);
|
listener->RemoveAnonymousClient(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Stream->Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JsonRpcConnection::ProcessMessage(void)
|
bool JsonRpcConnection::ProcessMessage(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user