summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_queue.cpp
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2016-04-01 19:30:30 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2016-04-01 19:30:30 +0000
commiteba8d089881ba440d2067cb441539517e577d37b (patch)
tree88e51ae8b583cf7b129995bae2872583099fc58c /protocols/VKontakte/src/vk_queue.cpp
parent532867c22a80206120cd461d673775fdaafbe4d9 (diff)
VKontakte:
gzip support support persistent connection to api.vk.com (patch by MikalaiR) version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@16568 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_queue.cpp')
-rw-r--r--protocols/VKontakte/src/vk_queue.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp
index 2a6bae1e38..2f969937fc 100644
--- a/protocols/VKontakte/src/vk_queue.cpp
+++ b/protocols/VKontakte/src/vk_queue.cpp
@@ -48,11 +48,21 @@ void CVkProto::ExecuteRequest(AsyncHttpRequest *pReq)
pReq->dataLength = pReq->m_szParam.GetLength();
}
}
+
+ if (pReq->m_bApiReq) {
+ pReq->flags |= NLHRF_PERSISTENT;
+ pReq->nlc = m_hAPIConnection;
+ }
+
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
+ (this->*(pReq->m_pFunc))(reply, pReq); // may be set pReq->bNeedsRestart
+
+ if (pReq->m_bApiReq)
+ m_hAPIConnection = reply->nlc;
+
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply);
}
else if (pReq->bIsMainConn) {
@@ -70,6 +80,10 @@ void CVkProto::ExecuteRequest(AsyncHttpRequest *pReq)
}
}
debugLogA("CVkProto::ExecuteRequest pReq->bNeedsRestart = %d", (int)pReq->bNeedsRestart);
+
+ if (!reply)
+ m_hAPIConnection = NULL;
+
} while (pReq->bNeedsRestart && !m_bTerminated);
delete pReq;
}
@@ -129,6 +143,8 @@ void CVkProto::WorkerThread(void*)
Push(pReq);
}
+ m_hAPIConnection = NULL;
+
while (true) {
WaitForSingleObject(m_evRequestsQueue, 1000);
if (m_bTerminated)
@@ -156,6 +172,10 @@ void CVkProto::WorkerThread(void*)
}
}
+ if (m_hAPIConnection)
+ Netlib_CloseHandle(m_hAPIConnection);
+
+ m_hAPIConnection = NULL;
m_hWorkerThread = 0;
debugLogA("CVkProto::WorkerThread: leaving");
}