summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_pollserver.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-07-24 14:30:13 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-07-24 14:30:13 +0300
commit103de9c164934b2393dfcba7011625f90c8a2097 (patch)
treef7a4a09afe29398f3b7605d7d0db264638a18150 /protocols/VKontakte/src/vk_pollserver.cpp
parent541eab20530165d10592a9fda590f435c6a8b4be (diff)
NLHR_PTR - smart pointers make better code
Diffstat (limited to 'protocols/VKontakte/src/vk_pollserver.cpp')
-rw-r--r--protocols/VKontakte/src/vk_pollserver.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp
index 80a6b91f8b..09c5a59878 100644
--- a/protocols/VKontakte/src/vk_pollserver.cpp
+++ b/protocols/VKontakte/src/vk_pollserver.cpp
@@ -249,7 +249,7 @@ int CVkProto::PollServer()
debugLogA("CVkProto::PollServer (online)");
int iPollConnRetry = MAX_RETRIES;
- NETLIBHTTPREQUEST *reply;
+
CMStringA szReqUrl(FORMAT, "https://%s?act=a_check&key=%s&ts=%s&wait=25&access_token=%s&mode=%d&version=%d", m_pollingServer, m_pollingKey, m_pollingTs, m_szAccessToken, 106, 2);
// see mode parametr description on https://vk.com/dev/using_longpoll (Russian version)
NETLIBHTTPREQUEST req = {};
@@ -265,6 +265,7 @@ int CVkProto::PollServer()
tLocalPoolThreadTimer = m_tPoolThreadTimer = time(0);
}
+ NLHR_PTR reply(0);
while ((reply = Netlib_HttpTransaction(m_hNetlibUser, &req)) == nullptr) {
{
mir_cslock lck(m_csPoolThreadTimer);
@@ -310,14 +311,12 @@ int CVkProto::PollServer()
|| (reply->resultCode >= 500 && reply->resultCode <= 509)) {
debugLogA("CVkProto::PollServer is dead. Error code - %d", reply->resultCode);
ClosePollingConnection();
- Netlib_FreeHttpRequest(reply);
ShutdownSession();
return 0;
}
m_pollingConn = reply->nlc;
- Netlib_FreeHttpRequest(reply);
debugLogA("CVkProto::PollServer return %d", retVal);
return retVal;
}