diff options
author | George Hazan <george.hazan@gmail.com> | 2013-10-13 09:39:44 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-10-13 09:39:44 +0000 |
commit | 6c0e8d4f20c3a0dc97176072602ce2d719916a6f (patch) | |
tree | 32305bc59c807a5ab579dd24a6185b393a64dee5 /protocols | |
parent | 31a3836b01d7b7f0991f32bb3269310055a61012 (diff) |
also to control the duplicate polling thread creation
git-svn-id: http://svn.miranda-ng.org/main/trunk@6483 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 7 |
2 files changed, 5 insertions, 4 deletions
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<void> 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");
}
|