]> granicus.if.org Git - icinga2/commitdiff
Use the main threadpool to disconnect API clients
authorGunnar Beutner <gunnar@beutner.name>
Fri, 27 Feb 2015 17:31:37 +0000 (18:31 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Fri, 27 Feb 2015 17:32:28 +0000 (18:32 +0100)
refs #8554

lib/remote/apiclient.cpp

index cf33aec4a0f06bf875e6615d71f48e21012d9da2..69dee98bdda932ef6f43818db4b20b378d222455 100644 (file)
@@ -258,11 +258,8 @@ Value RequestCertificateHandler(const MessageOrigin& origin, const Dictionary::P
 void ApiClient::TimeoutTimerHandler(void)
 {
        if (m_Seen < Utility::GetTime() - 60 && (!m_Endpoint || !m_Endpoint->GetSyncing())) {
-               /* Obtain a strong reference to ourselves because Disconnect otherwise removes the last reference */
-               ApiClient::Ptr self = this;
-
                Log(LogInformation, "ApiClient")
                    <<  "No messages for identity '" << m_Identity << "' have been received in the last 60 seconds.";
-               Disconnect();
+               Utility::QueueAsyncCallback(boost::bind(&ApiClient::Disconnect, ApiClient::Ptr(this)));
        }
 }