From 47ef7460d44bd169ada52ae8b1a2c7fa6f27d0d4 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Sat, 29 Nov 2014 15:33:06 +0000 Subject: VKontakte: fix(?) 5 sec freeze on Miranda shutdown git-svn-id: http://svn.miranda-ng.org/main/trunk@11152 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_queue.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'protocols/VKontakte/src/vk_queue.cpp') diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index 5fbbff50df..0740c14ce6 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -58,7 +58,7 @@ void CVkProto::ExecuteRequest(AsyncHttpRequest *pReq) 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){ + else if (pReq->m_iRetry && !m_bTerminated){ pReq->bNeedsRestart = true; Sleep(1000); //Pause for fix err pReq->m_iRetry--; @@ -70,7 +70,7 @@ void CVkProto::ExecuteRequest(AsyncHttpRequest *pReq) } } debugLogA("CVkProto::ExecuteRequest pReq->bNeedsRestart = %d", (int)pReq->bNeedsRestart); - } while (pReq->bNeedsRestart); + } while (pReq->bNeedsRestart && !m_bTerminated); delete pReq; } @@ -127,6 +127,8 @@ void CVkProto::WorkerThread(void*) m_arRequestsQueue.remove(0); need_sleep = (m_arRequestsQueue.getCount() > 1) && (pReq->m_bApiReq); // more than two to not gather } + if (m_bTerminated) + break; ExecuteRequest(pReq); if (need_sleep) // There can be maximum 3 requests to API methods per second from a client Sleep(330); // (c) https://vk.com/dev/api_requests -- cgit v1.2.3