summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3dae3b4)
raw | patch | inline | side by side (parent: 3dae3b4)
author | Marc Fournier <marc.fournier@camptocamp.com> | |
Thu, 2 Apr 2015 16:25:42 +0000 (18:25 +0200) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Thu, 2 Apr 2015 16:25:42 +0000 (18:25 +0200) |
also use the per-instance interval or plugin_get_interval() as the
default value, depending on which one is configured.
default value, depending on which one is configured.
src/curl_json.c | patch | blob | history |
diff --git a/src/curl_json.c b/src/curl_json.c
index 4cd4aec91d5155b08339d1a4c6ca72cc68325e47..292b262cc16cd99dca803568af191eaf42150f9a 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
curl_easy_setopt (db->curl, CURLOPT_HTTPHEADER, db->headers);
if (db->post_body != NULL)
curl_easy_setopt (db->curl, CURLOPT_POSTFIELDS, db->post_body);
- curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS,
- db->timeout > 0 ?
- db->timeout :
- ( db->interval > 0 ? db->interval : cf_get_default_interval () ));
+
+ if (db->timeout >= 0)
+ curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS, db->timeout);
+ else if (db->interval > 0)
+ curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS,
+ CDTIME_T_TO_MS(db->timeout));
+ else
+ curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS,
+ CDTIME_T_TO_MS(plugin_get_interval()));
return (0);
} /* }}} int cj_init_curl */
}
memset (db, 0, sizeof (*db));
+ db->timeout = -1;
+
if (strcasecmp ("URL", ci->key) == 0)
status = cf_util_get_string (ci, &db->url);
else if (strcasecmp ("Sock", ci->key) == 0)