summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZak <zakscomputers@hotmail.com>2020-01-17 20:21:49 +0200
committerZak <zakscomputers@hotmail.com>2020-02-26 08:55:39 +0200
commit70c39737db18619a9ac37264ab0f9187871e7907 (patch)
tree09d6249bffacb67d31b42401da3990eb71d25cf7
parentc6f0c0d12e3175ef0a60d8b6f5922bb314b66bf0 (diff)
Disconnect while downloading
Previously if a disconnect occured while downloading a non recoverable error was displayed. This PR attempts to fix this by making sure `request_completed` signal is emitted with an `STATUS_CONNECTION_ERROR` response code.
-rw-r--r--scene/main/http_request.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 3c89069816..e89000f21b 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -349,6 +349,8 @@ bool HTTPRequest::_update_connection() {
}
client->poll();
+ if (client->get_status() != HTTPClient::STATUS_BODY)
+ break; // State changed after this poll, will check at next iteration.
PoolByteArray chunk = client->read_response_body_chunk();
downloaded += chunk.size();