From c24d2279cf53d917b44d4a5ba4fe9112f394d8a9 Mon Sep 17 00:00:00 2001 From: ElzorFox Date: Thu, 3 Jan 2019 13:38:56 +0500 Subject: VKontakte: fix #1712 (hang at exit) copyrightes update version bump --- protocols/VKontakte/src/main.cpp | 2 +- protocols/VKontakte/src/misc.cpp | 2 +- protocols/VKontakte/src/stdafx.cxx | 2 +- protocols/VKontakte/src/stdafx.h | 2 +- protocols/VKontakte/src/version.h | 4 ++-- protocols/VKontakte/src/vk.h | 2 +- protocols/VKontakte/src/vk_avatars.cpp | 2 +- protocols/VKontakte/src/vk_captcha.cpp | 2 +- protocols/VKontakte/src/vk_chats.cpp | 2 +- protocols/VKontakte/src/vk_dialogs.cpp | 2 +- protocols/VKontakte/src/vk_dialogs.h | 2 +- protocols/VKontakte/src/vk_feed.cpp | 2 +- protocols/VKontakte/src/vk_files.cpp | 2 +- protocols/VKontakte/src/vk_history.cpp | 2 +- protocols/VKontakte/src/vk_messages.cpp | 2 +- protocols/VKontakte/src/vk_options.cpp | 2 +- protocols/VKontakte/src/vk_options.h | 2 +- protocols/VKontakte/src/vk_pollserver.cpp | 2 +- protocols/VKontakte/src/vk_proto.cpp | 2 +- protocols/VKontakte/src/vk_proto.h | 6 +++--- protocols/VKontakte/src/vk_queue.cpp | 5 ++++- protocols/VKontakte/src/vk_search.cpp | 2 +- protocols/VKontakte/src/vk_status.cpp | 2 +- protocols/VKontakte/src/vk_struct.cpp | 2 +- protocols/VKontakte/src/vk_struct.h | 2 +- protocols/VKontakte/src/vk_thread.cpp | 32 ++++++++++++++++++++++--------- protocols/VKontakte/src/vk_wallpost.cpp | 2 +- 27 files changed, 55 insertions(+), 38 deletions(-) (limited to 'protocols') diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp index bf375bbd98..8e2909bfa5 100644 --- a/protocols/VKontakte/src/main.cpp +++ b/protocols/VKontakte/src/main.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 diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 3084ffa59e..196f76f29f 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.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 diff --git a/protocols/VKontakte/src/stdafx.cxx b/protocols/VKontakte/src/stdafx.cxx index 1f190141bd..d7cdd95453 100644 --- a/protocols/VKontakte/src/stdafx.cxx +++ b/protocols/VKontakte/src/stdafx.cxx @@ -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 diff --git a/protocols/VKontakte/src/stdafx.h b/protocols/VKontakte/src/stdafx.h index d039a13d52..2fbaf54151 100644 --- a/protocols/VKontakte/src/stdafx.h +++ b/protocols/VKontakte/src/stdafx.h @@ -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 diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index 468709e5b9..53c1a8f399 100644 --- a/protocols/VKontakte/src/version.h +++ b/protocols/VKontakte/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 8 -#define __BUILD_NUM 0 +#define __BUILD_NUM 1 #include @@ -10,4 +10,4 @@ #define __DESCRIPTION "VKontakte protocol support for Miranda NG." #define __AUTHOR "Miranda NG team" #define __AUTHORWEB "https://miranda-ng.org/p/VKontakte/" -#define __COPYRIGHT "© 2013-18 Miranda NG team" +#define __COPYRIGHT "© 2013-19 Miranda NG team" diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index 4e4eac7697..77aed6241c 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -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 diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index 64d8d53a3d..ddfbbdb31d 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.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 diff --git a/protocols/VKontakte/src/vk_captcha.cpp b/protocols/VKontakte/src/vk_captcha.cpp index 72b8809e94..b0d5225cab 100644 --- a/protocols/VKontakte/src/vk_captcha.cpp +++ b/protocols/VKontakte/src/vk_captcha.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 diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index d75f699e74..406582b9fc 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.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 diff --git a/protocols/VKontakte/src/vk_dialogs.cpp b/protocols/VKontakte/src/vk_dialogs.cpp index fd394cd67c..3ccf89ab6a 100644 --- a/protocols/VKontakte/src/vk_dialogs.cpp +++ b/protocols/VKontakte/src/vk_dialogs.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 diff --git a/protocols/VKontakte/src/vk_dialogs.h b/protocols/VKontakte/src/vk_dialogs.h index ba77fc52db..5a43d7c595 100644 --- a/protocols/VKontakte/src/vk_dialogs.h +++ b/protocols/VKontakte/src/vk_dialogs.h @@ -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 diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 7581f7f8bc..d4953277de 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.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 diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index 717ba18dcf..740bf42486 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.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 diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index e6271b6835..2b3e00952b 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.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 diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 395f1818cd..349cd997e7 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.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 diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 6bab6d4eab..678fea38f0 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.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 diff --git a/protocols/VKontakte/src/vk_options.h b/protocols/VKontakte/src/vk_options.h index c40d658adc..c0a2bc415a 100644 --- a/protocols/VKontakte/src/vk_options.h +++ b/protocols/VKontakte/src/vk_options.h @@ -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 diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp index 6ccbeb039c..c023dd0825 100644 --- a/protocols/VKontakte/src/vk_pollserver.cpp +++ b/protocols/VKontakte/src/vk_pollserver.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 diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 1785b36830..7e01cb4e7f 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.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 diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 88c2d6f408..d1d073ec2a 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -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 @@ -366,8 +366,8 @@ private: bool ApplyCaptcha(AsyncHttpRequest *pReq, const JSONNode&); void ConnectionFailed(int iReason); void OnLoggedIn(); - void ClosePollingConnection(); - void CloseAPIConnection(); + void ClosePollingConnection(bool bShutdown = false); + void CloseAPIConnection(bool bShutdown = false); void OnLoggedOut(); void ShutdownSession(); void SetAvatarUrl(MCONTACT hContact, CMStringW &wszUrl); diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index d89502e67d..f0c0bce359 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.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 @@ -54,6 +54,9 @@ void CVkProto::ExecuteRequest(AsyncHttpRequest *pReq) pReq->nlc = m_hAPIConnection; } + if (m_bTerminated) + break; + debugLogA("CVkProto::ExecuteRequest \n====\n%s\n====\n", pReq->szUrl); NETLIBHTTPREQUEST *reply = Netlib_HttpTransaction(m_hNetlibUser, pReq); if (reply != nullptr) { diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index 9cba181b6f..10b47f4f89 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.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 diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index 89011c4e89..cd6df4fc71 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.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 diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp index 9fb9ca08b3..375efbd82b 100644 --- a/protocols/VKontakte/src/vk_struct.cpp +++ b/protocols/VKontakte/src/vk_struct.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 diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h index 96916c6fd3..c659b04313 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -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 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; diff --git a/protocols/VKontakte/src/vk_wallpost.cpp b/protocols/VKontakte/src/vk_wallpost.cpp index aa41fcec2a..1205fcff43 100644 --- a/protocols/VKontakte/src/vk_wallpost.cpp +++ b/protocols/VKontakte/src/vk_wallpost.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 -- cgit v1.2.3