summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_queue.cpp
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2014-11-28 07:53:55 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2014-11-28 07:53:55 +0000
commitc602f1813c094cf5b355867ee253a9ad4ef3c147 (patch)
treefd644e63e9078c4d47225d08178d0fde9184f091 /protocols/VKontakte/src/vk_queue.cpp
parent0c89be2bea895bfe6c6077f4ac09d72fdffd160f (diff)
VKontakte:
fix unset and timer for multiprotocol configuration remove 'goto' contructions code cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@11127 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_queue.cpp')
-rw-r--r--protocols/VKontakte/src/vk_queue.cpp70
1 files changed, 33 insertions, 37 deletions
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp
index aeaf052028..5fbbff50df 100644
--- a/protocols/VKontakte/src/vk_queue.cpp
+++ b/protocols/VKontakte/src/vk_queue.cpp
@@ -35,46 +35,42 @@ void CVkProto::UninitQueue()
void CVkProto::ExecuteRequest(AsyncHttpRequest *pReq)
{
CMStringA str;
-
-LBL_Restart:
- pReq->bNeedsRestart = false;
- pReq->szUrl = pReq->m_szUrl.GetBuffer();
- if (!pReq->m_szParam.IsEmpty()) {
- if (pReq->requestType == REQUEST_GET) {
- str.Format("%s?%s", pReq->m_szUrl, pReq->m_szParam);
- pReq->szUrl = str.GetBuffer();
+ do {
+ pReq->bNeedsRestart = false;
+ pReq->szUrl = pReq->m_szUrl.GetBuffer();
+ if (!pReq->m_szParam.IsEmpty()) {
+ if (pReq->requestType == REQUEST_GET) {
+ str.Format("%s?%s", pReq->m_szUrl, pReq->m_szParam);
+ pReq->szUrl = str.GetBuffer();
+ }
+ else {
+ pReq->pData = mir_strdup(pReq->m_szParam.GetBuffer());
+ pReq->dataLength = pReq->m_szParam.GetLength();
+ }
}
- else {
- pReq->pData = mir_strdup(pReq->m_szParam.GetBuffer());
- pReq->dataLength = pReq->m_szParam.GetLength();
+ debugLogA("CVkProto::ExecuteRequest \n====\n%s\n====\n", pReq->szUrl);
+ NETLIBHTTPREQUEST *reply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)pReq);
+ if (reply != NULL) {
+ if (pReq->m_pFunc != NULL)
+ (this->*(pReq->m_pFunc))(reply, pReq); // may be set pReq->bNeedsRestart
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply);
}
- }
-
- debugLogA("CVkProto::ExecuteRequest \n====\n%s\n====\n", pReq->szUrl);
- NETLIBHTTPREQUEST *reply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)pReq);
- if (reply != NULL) {
- if (pReq->m_pFunc != NULL)
- (this->*(pReq->m_pFunc))(reply, pReq);
-
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply);
- if (pReq->bNeedsRestart)
- goto LBL_Restart;
- }
- else if (pReq->bIsMainConn) {
- if (m_iStatus >= ID_STATUS_CONNECTING && m_iStatus < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)
- ConnectionFailed(LOGINERR_NONETWORK);
- else if (pReq->m_iRetry){
- pReq->bNeedsRestart = true;
- Sleep(1000); //Pause for fix err
- pReq->m_iRetry--;
- debugLogA("CVkProto::ExecuteRequest restarting retry = %d", MAX_RETRIES - pReq->m_iRetry);
- goto LBL_Restart;
- }
- else{
- debugLogA("CVkProto::ExecuteRequest ShutdownSession");
- ShutdownSession();
+ else if (pReq->bIsMainConn) {
+ if (m_iStatus >= ID_STATUS_CONNECTING && m_iStatus < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)
+ ConnectionFailed(LOGINERR_NONETWORK);
+ else if (pReq->m_iRetry){
+ pReq->bNeedsRestart = true;
+ Sleep(1000); //Pause for fix err
+ pReq->m_iRetry--;
+ debugLogA("CVkProto::ExecuteRequest restarting retry = %d", MAX_RETRIES - pReq->m_iRetry);
+ }
+ else{
+ debugLogA("CVkProto::ExecuteRequest ShutdownSession");
+ ShutdownSession();
+ }
}
- }
+ debugLogA("CVkProto::ExecuteRequest pReq->bNeedsRestart = %d", (int)pReq->bNeedsRestart);
+ } while (pReq->bNeedsRestart);
delete pReq;
}