From c24e4b0b1e86eb71ca73cb675e2d49f9326be3a6 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 2 Dec 2018 09:30:50 +0900 Subject: [PATCH] adjust timeout values for libcurl (issue #256) (#261) This change adjusts the two core timeout parameters of libcurl operation - dataTimeout: changed from 3600sec to 300sec this timeout controls the max time when there is no data incoming (actually below CURLOPT_LOW_SPEED_LIMIT) - operationTimeout: added 3600sec this timeout controls the maximally allowed connection timeout --- src/onedrive.d | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/onedrive.d b/src/onedrive.d index 13c80a11..3854be15 100644 --- a/src/onedrive.d +++ b/src/onedrive.d @@ -61,8 +61,25 @@ final class OneDriveApi { this.cfg = cfg; http = HTTP(); + // DNS lookup timeout http.dnsTimeout = (dur!"seconds"(5)); - http.dataTimeout = (dur!"seconds"(3600)); + // timeout for connecting + http.connectTimeout = (dur!"seconds"(10)); + // Timeouts + // with the following settings we force + // - if there is no data flow for 5min, abort + // - if the download time for one item exceeds 1h, abort + // + // timeout for activity on connection + // this translates into Curl's CURLOPT_LOW_SPEED_TIME + // which says + // It contains the time in number seconds that the + // transfer speed should be below the CURLOPT_LOW_SPEED_LIMIT + // for the library to consider it too slow and abort. + http.dataTimeout = (dur!"seconds"(300)); + // maximum time an operation is allowed to take + // This includes dns resolution, connecting, data transfer, etc. + http.operationTimeout = (dur!"seconds"(3600)); // Specify how many redirects should be allowed http.maxRedirects(5);