diff options
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 48 |
1 files changed, 26 insertions, 22 deletions
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;
|