summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2016-05-23 11:07:34 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2016-05-23 11:07:34 +0000
commit9f0105daab3c080213ebb30d3a6449bb3d77e37f (patch)
treecbeba0177cf332ab024408a4013a788e16ddb301 /protocols
parenta22596e0a8d424b18c5396b6584de57cccd180c6 (diff)
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
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/src/vk_proto.h3
-rw-r--r--protocols/VKontakte/src/vk_queue.cpp7
-rw-r--r--protocols/VKontakte/src/vk_status.cpp3
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp6
4 files changed, 12 insertions, 7 deletions
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 <http://www.gnu.org/licenses/>.
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();
}