diff options
author | ElzorFox <elzorfox@ya.ru> | 2019-01-03 13:38:56 +0500 |
---|---|---|
committer | ElzorFox <elzorfox@ya.ru> | 2019-01-03 13:38:56 +0500 |
commit | c24d2279cf53d917b44d4a5ba4fe9112f394d8a9 (patch) | |
tree | 4700f4c8c151da4a7ca219f0a770375256f18744 /protocols/VKontakte/src/vk_thread.cpp | |
parent | 6e2232c39df713136602183d2b42889aea7024b8 (diff) |
VKontakte:
fix #1712 (hang at exit)
copyrightes update
version bump
Diffstat (limited to 'protocols/VKontakte/src/vk_thread.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 9b5bc2c1d5..6b3ba96c13 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -1,5 +1,5 @@ /*
-Copyright (c) 2013-18 Miranda NG team (https://miranda-ng.org)
+Copyright (c) 2013-19 Miranda NG team (https://miranda-ng.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -98,17 +98,31 @@ void CVkProto::OnLoggedIn() db_unset(0, m_szModuleName, "LastNotificationsReqTime");
}
-void CVkProto::ClosePollingConnection()
+void CVkProto::ClosePollingConnection(bool bShutdown)
{
- if (m_pollingConn)
- Netlib_CloseHandle(m_pollingConn);
+ if (!m_pollingConn)
+ return;
+
+ debugLogA("CVkProto::ClosePollingConnection %d", bShutdown ? 1 : 0);
+
+ if (bShutdown)
+ Netlib_Shutdown(m_pollingConn);
+
+ Netlib_CloseHandle(m_pollingConn);
m_pollingConn = nullptr;
}
-void CVkProto::CloseAPIConnection()
+void CVkProto::CloseAPIConnection(bool bShutdown)
{
- if (m_hAPIConnection)
- Netlib_CloseHandle(m_hAPIConnection);
+ if (!m_hAPIConnection)
+ return;
+
+ debugLogA("CVkProto::CloseAPIConnection %d", bShutdown ? 1 : 0);
+
+ if (bShutdown)
+ Netlib_Shutdown(m_hAPIConnection);
+
+ Netlib_CloseHandle(m_hAPIConnection);
m_hAPIConnection = nullptr;
}
@@ -127,8 +141,8 @@ void CVkProto::OnLoggedOut() m_hWorkerThread = nullptr;
}
- CloseAPIConnection();
- ClosePollingConnection();
+ CloseAPIConnection(true);
+ ClosePollingConnection(true);
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)m_iStatus, ID_STATUS_OFFLINE);
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
|