diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 14 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 2 |
2 files changed, 14 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()
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 2768b61ebe..03e18048e3 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PS_BANUSER "/BanUser"
#define PS_REPORTABUSE "/ReportAbuse"
#define MAXHISTORYMIDSPERONE 200
+#define MAX_RETRIES 10
struct CVkProto;
typedef void (CVkProto::*VK_REQUEST_HANDLER)(NETLIBHTTPREQUEST*, struct AsyncHttpRequest*);
@@ -42,6 +43,7 @@ struct AsyncHttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject VK_REQUEST_HANDLER m_pFunc;
void *pUserInfo;
bool m_bApiReq;
+ int m_iRetry;
};
struct PARAM
|