[icinga-checkins] icinga.org: icinga2/support/2.0: Fix another deadlock in ApiClient:: SendMessage

git at icinga.org git at icinga.org
Mon Jun 30 15:44:28 CEST 2014


Module: icinga2
Branch: support/2.0
Commit: a0c09303251d22738f82a9c35a66d327c98699a3
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=a0c09303251d22738f82a9c35a66d327c98699a3

Author: Gunnar Beutner <gunnar at beutner.name>
Date:   Mon Jun 30 14:01:07 2014 +0200

Fix another deadlock in ApiClient::SendMessage

refs #6368

---

 lib/remote/apiclient.cpp |    2 +-
 lib/remote/apiclient.hpp |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/remote/apiclient.cpp b/lib/remote/apiclient.cpp
index 9203094..f48a987 100644
--- a/lib/remote/apiclient.cpp
+++ b/lib/remote/apiclient.cpp
@@ -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();
diff --git a/lib/remote/apiclient.hpp b/lib/remote/apiclient.hpp
index b491708..666262e 100644
--- a/lib/remote/apiclient.hpp
+++ b/lib/remote/apiclient.hpp
@@ -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;



More information about the icinga-checkins mailing list