diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-10-01 07:08:42 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-10-01 07:08:42 +0000 |
commit | ad3488c78ba1d6c077c584849f6c6c71f91cc35b (patch) | |
tree | c69baf0e47bbcb0436be8cb16cad1756a133f4e6 /protocols/VKontakte/src/misc.cpp | |
parent | 1f3f340be39ea193b1c210ddd986d74b468ea4ef (diff) |
VKontakte: fix freeze proto when internal error occurred.
git-svn-id: http://svn.miranda-ng.org/main/trunk@10661 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/misc.cpp')
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 0f3396b72f..7eb1a6dde2 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -111,8 +111,16 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, NETLIBHTTPREQUEST *reply, case VKERR_TOO_MANY_REQ_PER_SEC:
case VKERR_FLOOD_CONTROL:
case VKERR_INTERNAL_SERVER_ERR:
- pReq->bNeedsRestart = true;
- Sleep(500); //Pause for fix err
+ if (pReq->m_iRetry > 0){
+ pReq->bNeedsRestart = true;
+ Sleep(500); //Pause for fix err
+ pReq->m_iRetry--;
+ }
+ else{
+ CMString msg, msgformat = TranslateT("Error %d. Data will not be send or received.");
+ msg.AppendFormat(msgformat, iErrorCode);
+ MsgPopup(NULL, msg.GetBuffer(), TranslateT("Error"), true);
+ }
break;
case VKERR_HIMSELF_AS_FRIEND:
case VKERR_YOU_ON_BLACKLIST:
@@ -239,6 +247,7 @@ AsyncHttpRequest::AsyncHttpRequest() AddHeader("Connection", "keep-alive");
AddHeader("Accept-Encoding", "booo");
pUserInfo = NULL;
+ m_iRetry = MAX_RETRIES;
}
AsyncHttpRequest::AsyncHttpRequest(CVkProto *ppro, int iRequestType, LPCSTR _url, bool bSecure, VK_REQUEST_HANDLER pFunc)
@@ -265,6 +274,7 @@ AsyncHttpRequest::AsyncHttpRequest(CVkProto *ppro, int iRequestType, LPCSTR _url requestType = iRequestType;
m_pFunc = pFunc;
pUserInfo = NULL;
+ m_iRetry = MAX_RETRIES;
}
AsyncHttpRequest::~AsyncHttpRequest()
|