]> granicus.if.org Git - icinga2/commitdiff
Fix another deadlock in ApiClient::SendMessage
authorGunnar Beutner <gunnar@beutner.name>
Mon, 30 Jun 2014 12:01:07 +0000 (14:01 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Mon, 30 Jun 2014 12:01:07 +0000 (14:01 +0200)
refs #6368

lib/remote/apiclient.cpp
lib/remote/apiclient.hpp

index 9203094f102b7517927e2dc318934056fad0fa70..f48a9873c500cd03a9f395f61e14e1aef3a5dc32 100644 (file)
@@ -67,7 +67,7 @@ ConnectionRole ApiClient::GetRole(void) const
 void ApiClient::SendMessage(const Dictionary::Ptr& message)
 {
        try {
-               ObjectLock olock(m_Stream);
+               boost::mutex::scoped_lock lock(m_WriteMutex);
                JsonRpc::SendMessage(m_Stream, message);
                if (message->Get("method") != "log::SetLogPosition")
                        m_Seen = Utility::GetTime();
index b491708c0fcc9f8f71157327b63d503812f2b1b9..666262eaaf7c2576ac409de149fef3f5ed1b72d6 100644 (file)
@@ -58,6 +58,7 @@ public:
        void SendMessage(const Dictionary::Ptr& request);
 
 private:
+       boost::mutex m_WriteMutex;
        String m_Identity;
        Endpoint::Ptr m_Endpoint;
        Stream::Ptr m_Stream;