Code

curl_json: use configured interval as default timeout value
authorMarc Fournier <marc.fournier@camptocamp.com>
Wed, 4 Jan 2017 00:05:49 +0000 (01:05 +0100)
committerMarc Fournier <marc.fournier@camptocamp.com>
Wed, 4 Jan 2017 00:05:49 +0000 (01:05 +0100)
When no timeout is specified, the default timeout should be set to the
configured interval, not the default timeout (which is -1, no timeout).

This bug got introduced in bce14a848.

src/curl_json.c

index 40e9c7ec6a1dd8ff3cafa02d8d90559d5a682301..37a4b8659294bed30642c0567471034e1d5fca74 100644 (file)
@@ -600,7 +600,7 @@ static int cj_init_curl(cj_t *db) /* {{{ */
     curl_easy_setopt(db->curl, CURLOPT_TIMEOUT_MS, (long)db->timeout);
   else if (db->interval > 0)
     curl_easy_setopt(db->curl, CURLOPT_TIMEOUT_MS,
-                     (long)CDTIME_T_TO_MS(db->timeout));
+                     (long)CDTIME_T_TO_MS(db->interval));
   else
     curl_easy_setopt(db->curl, CURLOPT_TIMEOUT_MS,
                      (long)CDTIME_T_TO_MS(plugin_get_interval()));