diff options
author | aunsane <aunsane@gmail.com> | 2018-04-19 12:56:50 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2018-04-19 12:56:50 +0300 |
commit | dab59fb556d65f4f6f4452fbee842ab5b8c16932 (patch) | |
tree | 6ea5e53d909ca607c6ad55c4a63ed16c02bf0422 /protocols/Steam | |
parent | b213f27e0cdf344e588ec2efb279e2507bc23c0c (diff) |
Steam: server sends a very low timeout, which leads to stuck in loop
Diffstat (limited to 'protocols/Steam')
-rw-r--r-- | protocols/Steam/src/steam_polling.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp index 1078b1a037..bd0cdaf8dd 100644 --- a/protocols/Steam/src/steam_polling.cpp +++ b/protocols/Steam/src/steam_polling.cpp @@ -183,9 +183,18 @@ void CSteamProto::OnGotPoll(const HttpResponse &response, void *arg) } json_string error = root["error"].as_string(); - if (error == "Timeout") + if (error == "Timeout") { + // too low timeout? + int timeout = root["sectimeout"].as_int(); + if (timeout < STEAM_API_TIMEOUT) { + debugLogA(__FUNCTION__ ": Timeout is too low (%d)", timeout); + // perhaps it will break connection + Sleep(STEAM_API_TIMEOUT * 1000); + } + // do nothing as this is not necessarily an error return; + } if (error == "OK") { // remember last message timestamp @@ -224,11 +233,6 @@ void CSteamProto::OnGotPoll(const HttpResponse &response, void *arg) // something wrong debugLogA(__FUNCTION__ ": %s (%d)", error.c_str(), response.GetStatusCode()); - // too low timeout? - int timeout = root["sectimeout"].as_int(); - if (timeout < STEAM_API_TIMEOUT) - debugLogA(__FUNCTION__ ": Timeout is too low (%d)", timeout); - // let it jump out of further processing param->errors = param->errorsLimit; } |