From b6d0a372771d1fac2a2276841f6d2bbac22e8552 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 4 Jan 2018 21:35:36 +0300 Subject: one more mir_cs --- protocols/FacebookRM/src/client.h | 3 +-- protocols/FacebookRM/src/communication.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/protocols/FacebookRM/src/client.h b/protocols/FacebookRM/src/client.h index 2b3157617c..1a99885826 100644 --- a/protocols/FacebookRM/src/client.h +++ b/protocols/FacebookRM/src/client.h @@ -41,7 +41,6 @@ public: hChannelCon = nullptr; hMessagesCon = nullptr; hFcbCon = nullptr; - fcb_conn_lock_ = nullptr; handle_ = nullptr; parent = nullptr; @@ -52,7 +51,7 @@ public: HNETLIBCONN hChannelCon; HNETLIBCONN hMessagesCon; HNETLIBCONN hFcbCon; - HANDLE fcb_conn_lock_; + mir_cs fcb_conn_lock_; // Random generator value for this client diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 8b987063d9..d2ea31ddd1 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -54,6 +54,8 @@ http::response facebook_client::sendRequest(HttpRequest *request) if (request->requestType == REQUEST_POST) request->Headers << CHAR_PARAM("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); + mir_cslockfull s(fcb_conn_lock_); s.unlock(); + // Set persistent connection (or not) switch (request->Persistent) { case ChannelRequest::NONE: @@ -69,7 +71,7 @@ http::response facebook_client::sendRequest(HttpRequest *request) request->flags |= NLHRF_PERSISTENT; break; case ChannelRequest::DEFAULT: - WaitForSingleObject(fcb_conn_lock_, INFINITE); + s.lock(); request->nlc = hFcbCon; request->flags |= NLHRF_PERSISTENT; break; @@ -91,7 +93,7 @@ http::response facebook_client::sendRequest(HttpRequest *request) hMessagesCon = pnlhr ? pnlhr->nlc : nullptr; break; case ChannelRequest::DEFAULT: - ReleaseMutex(fcb_conn_lock_); + s.unlock(); hFcbCon = pnlhr ? pnlhr->nlc : nullptr; break; } -- cgit v1.2.3