From 9622b075bcc7f4a01a325f0f970cabf4b554c1cc Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 27 Feb 2015 18:31:37 +0100 Subject: [PATCH] Use the main threadpool to disconnect API clients refs #8554 --- lib/remote/apiclient.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/remote/apiclient.cpp b/lib/remote/apiclient.cpp index cf33aec4a..69dee98bd 100644 --- a/lib/remote/apiclient.cpp +++ b/lib/remote/apiclient.cpp @@ -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))); } } -- 2.40.0