From 9f0105daab3c080213ebb30d3a6449bb3d77e37f Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Mon, 23 May 2016 11:07:34 +0000 Subject: VKontakte: fix (?) freeze status as offline on speedy status change git-svn-id: http://svn.miranda-ng.org/main/trunk@16861 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_proto.h | 3 ++- protocols/VKontakte/src/vk_queue.cpp | 7 +++++-- protocols/VKontakte/src/vk_status.cpp | 3 +++ protocols/VKontakte/src/vk_thread.cpp | 6 ++---- 4 files changed, 12 insertions(+), 7 deletions(-) (limited to 'protocols/VKontakte/src') diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index ecd9dd6869..0ad602b9c5 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -202,7 +202,8 @@ private: mir_cs m_csChatTyping, m_csLoadHistoryTask, - m_csRequestsQueue; + m_csRequestsQueue, + m_csSetStatus; int m_iLoadHistoryTask; diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index 78e70c0049..515f7ad80b 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -172,12 +172,15 @@ void CVkProto::WorkerThread(void*) } } - if (m_hAPIConnection) + if (m_hAPIConnection) { + debugLogA("CVkProto::WorkerThread: Netlib_CloseHandle(m_hAPIConnection) beg"); Netlib_CloseHandle(m_hAPIConnection); + debugLogA("CVkProto::WorkerThread: Netlib_CloseHandle(m_hAPIConnection) end"); + } m_hAPIConnection = NULL; m_hWorkerThread = 0; - debugLogA("CVkProto::WorkerThread: leaving"); + debugLogA("CVkProto::WorkerThread: leaving m_bTerminated = %d", m_bTerminated ? 1 : 0); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index 7932ca21d3..ef7d83b874 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -20,6 +20,9 @@ along with this program. If not, see . int CVkProto::SetStatus(int iNewStatus) { debugLogA("CVkProto::SetStatus iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d m_hWorkerThread = %d", iNewStatus, m_iStatus, m_iDesiredStatus, m_hWorkerThread == NULL ? 0 : 1); + + mir_cslock lck(m_csSetStatus); + if (m_iDesiredStatus == iNewStatus || iNewStatus == ID_STATUS_IDLE) return 0; diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 3e51da9baa..2430e21a15 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -32,11 +32,9 @@ static char fieldsName[] = "id, first_name, last_name, photo_100, bdate, sex, ti void CVkProto::ShutdownSession() { debugLogA("CVkProto::ShutdownSession"); - if (m_hWorkerThread) { - m_bTerminated = true; + m_bTerminated = true; + if (m_hWorkerThread) SetEvent(m_evRequestsQueue); - } - OnLoggedOut(); } -- cgit v1.2.3