diff options
author | George Hazan <ghazan@miranda.im> | 2018-01-04 21:35:36 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-01-04 21:35:36 +0300 |
commit | b6d0a372771d1fac2a2276841f6d2bbac22e8552 (patch) | |
tree | 1ffaae12b62cc5f52e668092d464aa061aa8d58e | |
parent | 1b89cbba1f3bc00ea24a8414b2e670c582ac5fc4 (diff) |
one more mir_cs
-rw-r--r-- | protocols/FacebookRM/src/client.h | 3 | ||||
-rw-r--r-- | 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; } |