summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-09-17 19:19:34 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-09-17 19:19:34 +0000
commitabb7f924a2718202ffd83eecd4a6463ff075b2ae (patch)
tree5e775bba3e4fc9db292f58d510c41e4b450d94a8 /protocols
parent73eedf8e1ef66a2b8d4d50483eea50fa6e3160b0 (diff)
Steam:
- attempt to fix one more crash git-svn-id: http://svn.miranda-ng.org/main/trunk@15373 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Steam/src/steam_pooling.cpp100
1 files changed, 51 insertions, 49 deletions
diff --git a/protocols/Steam/src/steam_pooling.cpp b/protocols/Steam/src/steam_pooling.cpp
index 32fe85d905..7a3a614aa9 100644
--- a/protocols/Steam/src/steam_pooling.cpp
+++ b/protocols/Steam/src/steam_pooling.cpp
@@ -182,67 +182,69 @@ void CSteamProto::PollingThread(void*)
if (!ResponseHttpOk(response))
{
- if (response != NULL)
- delete response;
-
errors++;
- continue;
}
else
- errors = 0;
-
- JSONROOT root(response->pData);
- JSONNode *node = json_get(root, "error");
- ptrT error(json_as_string(node));
-
- if (!lstrcmpi(error, _T("OK")))
{
- node = json_get(root, "messagelast");
- messageId = json_as_int(node);
-
- node = json_get(root, "messages");
- JSONNode *nroot = json_as_array(node);
-
- if (nroot != NULL)
+ JSONROOT root(response->pData);
+ if (root == NULL)
{
- ParsePollData(nroot);
- json_delete(nroot);
+ errors++;
}
-
- m_pollingConnection = response->nlc;
- }
- else if (!lstrcmpi(error, _T("Timeout")))
- {
- continue;
- }
- /*else if (!lstrcmpi(error, _T("Not Logged On"))) // 'else' below will handle this error, we don't need this particular check right now
- {
- if (!IsOnline())
+ else
{
- // need to relogin
- debugLog(_T("CSteamProto::PollingThread: not logged on"));
+ errors = 0;
+ JSONNode *node = json_get(root, "error");
+ if (node) {
+ ptrT error(json_as_string(node));
- SetStatus(ID_STATUS_OFFLINE);
- }
+ if (!lstrcmpi(error, _T("OK")))
+ {
+ node = json_get(root, "messagelast");
+ messageId = json_as_int(node);
- breaked = true;
- }*/
- else
- {
- // something wrong
- debugLog(_T("CSteamProto::PollingThread: %s (%d)"), error, response->resultCode);
+ node = json_get(root, "messages");
+ JSONNode *nroot = json_as_array(node);
+
+ if (nroot != NULL)
+ {
+ ParsePollData(nroot);
+ json_delete(nroot);
+ }
+
+ m_pollingConnection = response->nlc;
+ }
+ /*else if (!lstrcmpi(error, _T("Not Logged On"))) // 'else' below will handle this error, we don't need this particular check right now
+ {
+ if (!IsOnline())
+ {
+ // need to relogin
+ debugLog(_T("CSteamProto::PollingThread: not logged on"));
+
+ SetStatus(ID_STATUS_OFFLINE);
+ }
+
+ breaked = true;
+ }*/
+ else if (lstrcmpi(error, _T("Timeout")))
+ {
+ // something wrong
+ debugLog(_T("CSteamProto::PollingThread: %s (%d)"), error, response->resultCode);
- // token has expired
- if (response->resultCode == HTTP_CODE_UNAUTHORIZED)
- delSetting("TokenSecret");
+ // token has expired
+ if (response->resultCode == HTTP_CODE_UNAUTHORIZED)
+ delSetting("TokenSecret");
- // too low timeout?
- node = json_get(root, "sectimeout");
- int timeout = json_as_int(node);
- if (timeout < STEAM_API_TIMEOUT)
- debugLog(_T("CSteamProto::PollingThread: Timeout is too low (%d)"), timeout);
+ // too low timeout?
+ node = json_get(root, "sectimeout");
+ int timeout = json_as_int(node);
+ if (timeout < STEAM_API_TIMEOUT)
+ debugLog(_T("CSteamProto::PollingThread: Timeout is too low (%d)"), timeout);
- breaked = true;
+ breaked = true;
+ }
+ }
+ }
}
delete response;