summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-01-22 12:33:34 +0100
committerKonstantin Käfer <mail@kkaefer.com>2015-02-04 10:49:06 +0100
commitbf629c97db98cc835e324409edfd8729bb3583c2 (patch)
treecb85d46082f1a4c359e780e33031407423b4588a /platform
parent032c245bfee4977d235015d5b5eb349418f6b645 (diff)
downloadqtlocation-mapboxgl-bf629c97db98cc835e324409edfd8729bb3583c2.tar.gz
cancel the backoff timer when the request is canceled
Diffstat (limited to 'platform')
-rw-r--r--platform/darwin/http_request_cocoa.mm15
1 files changed, 15 insertions, 0 deletions
diff --git a/platform/darwin/http_request_cocoa.mm b/platform/darwin/http_request_cocoa.mm
index 77df1f6641..efcc910488 100644
--- a/platform/darwin/http_request_cocoa.mm
+++ b/platform/darwin/http_request_cocoa.mm
@@ -51,6 +51,7 @@ public:
~HTTPRequestImpl();
void cancel();
+ void cancelTimer();
void start();
void handleResult(NSData *data, NSURLResponse *res, NSError *error);
@@ -198,6 +199,9 @@ void HTTPRequestImpl::cancel() {
context->removeRequest(request);
request = nullptr;
+ // Stop the backoff timer to avoid re-triggering this request.
+ cancelTimer();
+
if (task) {
[task cancel];
[task release];
@@ -205,10 +209,21 @@ void HTTPRequestImpl::cancel() {
}
}
+void HTTPRequestImpl::cancelTimer() {
+ if (timer) {
+ uv_timer_stop(timer);
+ uv::close(timer);
+ timer = nullptr;
+ }
+}
+
HTTPRequestImpl::~HTTPRequestImpl() {
assert(!task);
assert(async);
+ // Stop the backoff timer to avoid re-triggering this request.
+ cancelTimer();
+
uv::close(async);
if (request) {