summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp1
-rw-r--r--protocols/VKontakte/src/vk_proto.h2
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp15
3 files changed, 17 insertions, 1 deletions
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 56b90c9dfa..5816c56bde 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -83,6 +83,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :
// Set all contacts offline -- in case we crashed
SetAllContactStatuses(ID_STATUS_OFFLINE);
+ m_iPollConnRetry = MAX_RETRIES;
vk_Instances.insert(this);
}
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 786bd082b6..f1d77e1be6 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -420,6 +420,8 @@ private:
m_bStikersAsSmyles,
m_bUserForceOnlineOnActivity;
+ int m_iPollConnRetry;
+
enum MarkMsgReadOn{ markOnRead, markOnReceive, markOnReply, markOnTyping };
int m_iMarkMessageReadOn;
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);