From 23f4eaedd82df2fd58b452f6e9730022f908a37a Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sun, 5 Apr 2015 20:23:09 +0000 Subject: SteamWeb: tuned long polling git-svn-id: http://svn.miranda-ng.org/main/trunk@12619 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/requests/poll.h | 2 +- protocols/SkypeWeb/src/skype_menus.h | 12 ++++++++---- protocols/SkypeWeb/src/skype_polling.cpp | 18 +++++++----------- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/requests/poll.h b/protocols/SkypeWeb/src/requests/poll.h index 585a7a1ca4..8e04ef0842 100644 --- a/protocols/SkypeWeb/src/requests/poll.h +++ b/protocols/SkypeWeb/src/requests/poll.h @@ -7,7 +7,7 @@ public: PollRequest(const char *regToken, const char *server = "client-s.gateway.messenger.live.com") : HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions/0/poll", server) { - //timeout = 30 * 1000; + timeout = INFINITE; flags |= NLHRF_PERSISTENT; Headers << CHAR_VALUE("Connection", "keep-alive") diff --git a/protocols/SkypeWeb/src/skype_menus.h b/protocols/SkypeWeb/src/skype_menus.h index 5a0fcaed6d..1cf6d1a3b2 100644 --- a/protocols/SkypeWeb/src/skype_menus.h +++ b/protocols/SkypeWeb/src/skype_menus.h @@ -2,10 +2,14 @@ #define _SKYPE_MENUS_H_ #define CMI_POSITION -201001000 -#define CMI_AUTH_REQUEST 0 -#define CMI_AUTH_GRANT 1 -#define CMI_GETSERVERHISTORY 2 -#define CMI_MAX 3 // this item shall be the last one + +enum +{ + CMI_AUTH_REQUEST, + CMI_AUTH_GRANT, + CMI_GETSERVERHISTORY, + CMI_MAX // this item shall be the last one +}; #define SMI_POSITION 200000 diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index e963aad83b..a4534846b8 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -57,10 +57,8 @@ void CSkypeProto::PollingThread(void*) while (!isTerminated && !breaked && errors < POLLING_ERRORS_LIMIT) { PollRequest *request = new PollRequest(regToken, server); - NETLIBHTTPREQUEST *response = request->Send(m_hNetlibUser); - m_pollingConnection = request->nlc; - delete request; - + request->nlc = m_pollingConnection; + NETLIBHTTPREQUEST *response = request->Send(m_hNetlibUser); if (response != NULL) { @@ -71,14 +69,12 @@ void CSkypeProto::PollingThread(void*) continue; } ParsePollData (root); + + m_pollingConnection = response->nlc; + CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); } - /*if (response->resultCode != 200) - { - errors++; - continue; - } - else - errors = 0;*/ + + delete request; } m_hPollingThread = NULL; m_pollingConnection = NULL; -- cgit v1.2.3