From 6c0e8d4f20c3a0dc97176072602ce2d719916a6f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 13 Oct 2013 09:39:44 +0000 Subject: also to control the duplicate polling thread creation git-svn-id: http://svn.miranda-ng.org/main/trunk@6483 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_proto.h | 2 +- protocols/VKontakte/src/vk_thread.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'protocols/VKontakte') diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 5ce0b55980..fe499ee558 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -165,7 +165,7 @@ private: UINT_PTR m_timer; ptrA m_pollingServer, m_pollingKey, m_pollingTs; - HANDLE m_pollingConn; + HANDLE m_pollingConn, m_hPollingThread; ULONG m_msgId; LIST m_sendIds; diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 373233f3b6..caaa8d8e91 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -422,8 +422,8 @@ void CVkProto::OnReceivePollingInfo(NETLIBHTTPREQUEST *reply, void*) m_pollingTs = mir_t2a( ptrT( json_as_string( json_get(pResponse, "ts")))); m_pollingKey = mir_t2a( ptrT( json_as_string( json_get(pResponse, "key")))); m_pollingServer = mir_t2a( ptrT( json_as_string( json_get(pResponse, "server")))); - if (m_pollingTs != NULL && m_pollingKey != NULL && m_pollingServer != NULL) - ForkThread(&CVkProto::PollingThread, 0); + if (!m_hPollingThread && m_pollingTs != NULL && m_pollingKey != NULL && m_pollingServer != NULL) + m_hPollingThread = ForkThreadEx(&CVkProto::PollingThread, NULL, NULL); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -524,6 +524,7 @@ void CVkProto::PollingThread(void*) if (PollServer() == -1) break; - m_pollingConn = 0; + m_hPollingThread = NULL; + m_pollingConn = NULL; debugLogA("CVkProto::PollingThread: leaving"); } -- cgit v1.2.3