diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-11-09 09:01:34 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-11-09 09:01:34 +0000 |
commit | 61e32f0ca35a86873c18fd619945b7255e5900da (patch) | |
tree | fa478ff642d32c3d9aa12e130d92a2a815c8f843 /protocols/VKontakte/src/vk_thread.cpp | |
parent | bc3a645445b09c80ddfb63c432e9968ebd1aea91 (diff) |
VKontakte: fix reconnect protocol after PollServer death
git-svn-id: http://svn.miranda-ng.org/main/trunk@10935 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_thread.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index a8b56f734d..5b899ca58c 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -75,6 +75,7 @@ void CVkProto::OnLoggedIn() {
debugLogA("CVkProto::OnLoggedIn");
m_bOnline = true;
+ m_iPollConnRetry = MAX_RETRIES;
SetServerStatus(m_iDesiredStatus);
// initialize online timer
@@ -978,10 +979,22 @@ int CVkProto::PollServer() debugLogA("CVkProto::PollServer is dead");
m_pollingConn = NULL;
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply);
- ShutdownSession();
+ if (m_iPollConnRetry){
+ m_iPollConnRetry--;
+ debugLogA("CVkProto::PollServer restarting %d", MAX_RETRIES - m_iPollConnRetry);
+ Sleep(1000);
+ PollServer();
+ }
+ else {
+ debugLogA("CVkProto::PollServer => ShutdownSession");
+ m_iPollConnRetry = MAX_RETRIES;
+ ShutdownSession();
+ }
return 0;
}
+ m_iPollConnRetry = MAX_RETRIES;
+
int retVal = 0;
if (reply->resultCode == 200) {
JSONROOT pRoot(reply->pData);
|