mirror of https://github.com/Icinga/icinga2.git
parent
31786fdaa1
commit
d5c33d84f7
|
@ -74,13 +74,6 @@ ConnectionRole ApiClient::GetRole(void) const
|
|||
|
||||
void ApiClient::SendMessage(const Dictionary::Ptr& message)
|
||||
{
|
||||
if (m_WriteQueue.GetLength() > 20000) {
|
||||
Log(LogWarning, "remote")
|
||||
<< "Closing connection for API identity '" << m_Identity << "': Too many queued messages.";
|
||||
Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
m_WriteQueue.Enqueue(boost::bind(&ApiClient::SendMessageSync, ApiClient::Ptr(this), message));
|
||||
}
|
||||
|
||||
|
@ -106,11 +99,6 @@ void ApiClient::SendMessageSync(const Dictionary::Ptr& message)
|
|||
}
|
||||
|
||||
void ApiClient::Disconnect(void)
|
||||
{
|
||||
Utility::QueueAsyncCallback(boost::bind(&ApiClient::DisconnectSync, ApiClient::Ptr(this)));
|
||||
}
|
||||
|
||||
void ApiClient::DisconnectSync(void)
|
||||
{
|
||||
Log(LogWarning, "ApiClient")
|
||||
<< "API client disconnected for identity '" << m_Identity << "'";
|
||||
|
@ -127,6 +115,8 @@ void ApiClient::DisconnectSync(void)
|
|||
} catch (const std::exception&) {
|
||||
/* Ignore the exception. */
|
||||
}
|
||||
|
||||
m_WriteQueue.Join();
|
||||
}
|
||||
|
||||
bool ApiClient::ProcessMessage(void)
|
||||
|
|
|
@ -58,7 +58,6 @@ public:
|
|||
ConnectionRole GetRole(void) const;
|
||||
|
||||
void Disconnect(void);
|
||||
void DisconnectSync(void);
|
||||
|
||||
void SendMessage(const Dictionary::Ptr& request);
|
||||
|
||||
|
|
Loading…
Reference in New Issue