summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte/src/vk_thread.cpp')
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp7
1 files changed, 4 insertions, 3 deletions
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");
}