From: Marc Fournier Date: Thu, 2 Apr 2015 16:21:52 +0000 (+0200) Subject: curl: allow Timeout to be set to 0 X-Git-Tag: collectd-5.5.0~56^2~9 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3dae3b4a426b3302227f58f015e33bea9813c9c9;p=collectd.git curl: allow Timeout to be set to 0 also use plugin_get_interval() rather than cf_get_default_interval() to take per-plugin interval in account. --- diff --git a/src/curl.c b/src/curl.c index 50315391..893cc54c 100644 --- a/src/curl.c +++ b/src/curl.c @@ -410,7 +410,12 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */ curl_easy_setopt (wp->curl, CURLOPT_HTTPHEADER, wp->headers); if (wp->post_body != NULL) curl_easy_setopt (wp->curl, CURLOPT_POSTFIELDS, wp->post_body); - curl_easy_setopt (wp->curl, CURLOPT_TIMEOUT_MS, wp->timeout > 0 ? wp->timeout : cf_get_default_interval ()); + + if (wp->timeout >= 0) + curl_easy_setopt (wp->curl, CURLOPT_TIMEOUT_MS, wp->timeout); + else + curl_easy_setopt (wp->curl, CURLOPT_TIMEOUT_MS, + CDTIME_T_TO_MS(plugin_get_interval())); return (0); } /* }}} int cc_page_init_curl */ @@ -442,7 +447,7 @@ static int cc_config_add_page (oconfig_item_t *ci) /* {{{ */ page->verify_host = 1; page->response_time = 0; page->response_code = 0; - page->timeout = 0; + page->timeout = -1; page->instance = strdup (ci->values[0].value.string); if (page->instance == NULL)