summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Steam/src/steam_pooling.cpp21
-rw-r--r--protocols/Steam/src/version.h2
2 files changed, 18 insertions, 5 deletions
diff --git a/protocols/Steam/src/steam_pooling.cpp b/protocols/Steam/src/steam_pooling.cpp
index 3a375d4ab3..64d72acb09 100644
--- a/protocols/Steam/src/steam_pooling.cpp
+++ b/protocols/Steam/src/steam_pooling.cpp
@@ -1,5 +1,7 @@
#include "common.h"
+#define POLLING_ERRORS_LIMIT 3
+
void CSteamProto::ParsePollData(JSONNODE *data)
{
JSONNODE *node, *item = NULL;
@@ -175,8 +177,9 @@ void CSteamProto::PollingThread(void*)
UINT32 messageId = getDword("MessageID", 0);
//SteamWebApi::PollApi::PollResult pollResult;
+ int errors = 0;
bool breaked = false;
- while (!isTerminated && !breaked)
+ while (!isTerminated && !breaked && errors < POLLING_ERRORS_LIMIT)
{
SteamWebApi::PollRequest *request = new SteamWebApi::PollRequest(token, umqId, messageId);
debugLogA("CSteamProto::PollingThread: %s", request->szUrl);
@@ -186,7 +189,15 @@ void CSteamProto::PollingThread(void*)
delete request;
if (response == NULL || response->resultCode != HTTP_STATUS_OK)
- return;
+ {
+ if (response != NULL)
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response);
+
+ errors++;
+ continue;
+ }
+ else
+ errors = 0;
JSONROOT root(response->pData);
JSONNODE *node = json_get(root, "error");
@@ -241,7 +252,9 @@ void CSteamProto::PollingThread(void*)
m_hPollingThread = NULL;
debugLogA("CSteamProto::PollingThread: leaving");
- // if something wrong, switch proto to offline
- if (breaked)
+ if (!isTerminated)
+ {
+ debugLogA("CSteamProto::PollingThread: unexpected termination; switching protocol to offline");
SetStatus(ID_STATUS_OFFLINE);
+ }
} \ No newline at end of file
diff --git a/protocols/Steam/src/version.h b/protocols/Steam/src/version.h
index 065a552217..d81bbde9e0 100644
--- a/protocols/Steam/src/version.h
+++ b/protocols/Steam/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 11
#define __RELEASE_NUM 0
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>