summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Steam/src/steam_login.cpp4
-rw-r--r--protocols/Steam/src/steam_proto.cpp15
-rw-r--r--protocols/Steam/src/steam_proto.h4
-rw-r--r--protocols/Steam/src/steam_request.cpp10
4 files changed, 21 insertions, 12 deletions
diff --git a/protocols/Steam/src/steam_login.cpp b/protocols/Steam/src/steam_login.cpp
index 3375a128d5..def14a9d26 100644
--- a/protocols/Steam/src/steam_login.cpp
+++ b/protocols/Steam/src/steam_login.cpp
@@ -75,8 +75,8 @@ bool CSteamProto::Relogin()
void CSteamProto::LogOut()
{
isTerminated = true;
- if (hRequestQueueThread)
- SetEvent(hRequestsQueueEvent);
+ if (m_hRequestQueueThread)
+ SetEvent(m_hRequestsQueueEvent);
ptrA token(getStringA("TokenSecret"));
if (mir_strlen(token) > 0)
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp
index 68c6c28767..fd7d5cf9d8 100644
--- a/protocols/Steam/src/steam_proto.cpp
+++ b/protocols/Steam/src/steam_proto.cpp
@@ -11,6 +11,7 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName)
isLoginAgain = false;
m_pollingConnection = nullptr;
m_hPollingThread = nullptr;
+ m_hRequestsQueueEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
// icons
wchar_t filePath[MAX_PATH];
@@ -78,8 +79,16 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName)
CSteamProto::~CSteamProto()
{
- Netlib_CloseHandle(m_hNetlibUser);
- m_hNetlibUser = NULL;
+ if (m_hNetlibUser)
+ {
+ Netlib_CloseHandle(m_hNetlibUser);
+ m_hNetlibUser = nullptr;
+ }
+ if (m_hRequestsQueueEvent)
+ {
+ CloseHandle(m_hRequestsQueueEvent);
+ m_hRequestsQueueEvent = nullptr;
+ }
}
MCONTACT CSteamProto::AddToList(int, PROTOSEARCHRESULT* psr)
@@ -322,7 +331,7 @@ int CSteamProto::SetStatus(int new_status)
isTerminated = false;
- hRequestQueueThread = ForkThreadEx(&CSteamProto::RequestQueueThread, NULL, NULL);
+ m_hRequestQueueThread = ForkThreadEx(&CSteamProto::RequestQueueThread, NULL, NULL);
}
diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h
index b07f44649c..fee78f4b02 100644
--- a/protocols/Steam/src/steam_proto.h
+++ b/protocols/Steam/src/steam_proto.h
@@ -87,8 +87,8 @@ protected:
time_t m_idleTS;
bool isTerminated, isConnected;
mir_cs requestQueueLock;
- HANDLE hRequestsQueueEvent;
- HANDLE hRequestQueueThread;
+ HANDLE m_hRequestsQueueEvent;
+ HANDLE m_hRequestQueueThread;
LIST<RequestQueueItem> requestQueue;
HANDLE m_pollingConnection, m_hPollingThread;
ULONG hAuthProcess;
diff --git a/protocols/Steam/src/steam_request.cpp b/protocols/Steam/src/steam_request.cpp
index ba2d931aa9..363f31a328 100644
--- a/protocols/Steam/src/steam_request.cpp
+++ b/protocols/Steam/src/steam_request.cpp
@@ -37,7 +37,7 @@ void CSteamProto::PushRequest(HttpRequest *request)
mir_cslock lock(requestQueueLock);
requestQueue.insert(item);
}
- SetEvent(hRequestsQueueEvent);
+ SetEvent(m_hRequestsQueueEvent);
}
void CSteamProto::PushRequest(HttpRequest *request, HttpCallback callback, void *param)
@@ -50,7 +50,7 @@ void CSteamProto::PushRequest(HttpRequest *request, HttpCallback callback, void
mir_cslock lock(requestQueueLock);
requestQueue.insert(item);
}
- SetEvent(hRequestsQueueEvent);
+ SetEvent(m_hRequestsQueueEvent);
}
void CSteamProto::PushRequest(HttpRequest *request, JsonCallback callback, void *param)
@@ -63,7 +63,7 @@ void CSteamProto::PushRequest(HttpRequest *request, JsonCallback callback, void
mir_cslock lock(requestQueueLock);
requestQueue.insert(item);
}
- SetEvent(hRequestsQueueEvent);
+ SetEvent(m_hRequestsQueueEvent);
}
void CSteamProto::RequestQueueThread(void*)
@@ -91,8 +91,8 @@ void CSteamProto::RequestQueueThread(void*)
SendRequest(item->request);
delete item;
}
- WaitForSingleObject(hRequestsQueueEvent, 1000);
+ WaitForSingleObject(m_hRequestsQueueEvent, 1000);
} while (!isTerminated);
- hRequestQueueThread = NULL;
+ m_hRequestQueueThread = NULL;
} \ No newline at end of file