From 5a94bdd5833fd13bb0404c549be79d51c9a9547f Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sat, 2 May 2015 17:16:33 +0000 Subject: git-svn-id: http://svn.miranda-ng.org/main/trunk@13381 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_trouter.cpp | 48 +++++++++++++++++--------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index 0f22c3d98f..59eb581d71 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -158,32 +158,36 @@ void CSkypeProto::TRouterThread(void*) request->nlc = m_TrouterConnection; NETLIBHTTPREQUEST *response = request->Send(m_hNetlibUser); - if (response != NULL) + if (response == NULL) { - if (response->resultCode == 200) - { - if (response->pData) - { - char *json = strstr(response->pData, "{"); - - if (json == NULL) - continue; - - JSONROOT root(json); - ptrA szBody(mir_t2a(ptrT(json_as_string(json_get(root, "body"))))); - JSONNODE *headers = json_get(root, "headers"); - JSONNODE *body = json_parse(szBody); - OnTrouterEvent(body, headers); - } - } - else + errors++; + delete request; + continue; + } + + if (response->resultCode == 200) + { + if (response->pData) { - SendRequest(new HealthTrouterRequest(ccid), &CSkypeProto::OnHealth); + char *json = strstr(response->pData, "{"); + if (json == NULL) + continue; + + JSONROOT root(json); + ptrA szBody(mir_t2a(ptrT(json_as_string(json_get(root, "body"))))); + JSONNODE *headers = json_get(root, "headers"); + JSONNODE *body = json_parse(szBody); + OnTrouterEvent(body, headers); } - - m_TrouterConnection = response->nlc; - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); } + else + { + SendRequest(new HealthTrouterRequest(ccid), &CSkypeProto::OnHealth); + CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); + delete request; + break; + } + CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); delete request; } m_hTrouterThread = NULL; -- cgit v1.2.3