summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/VKontakte/src/vk_proto.h2
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp7
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");
}