diff --git a/src/bind.c b/src/bind.c
index 5324ceb16e0776366ae63e7c01124b9240a7f24b..6eac159cbcf78b1f36651aa7468f389a9baf74a8 100644 (file)
--- a/src/bind.c
+++ b/src/bind.c
static int global_zone_maint_stats = 1;
static int global_resolver_stats = 0;
static int global_memory_stats = 1;
+static int timeout = -1;
static cb_view_t *views = NULL;
static size_t views_num = 0;
if (type_instance) {
sstrncpy(vl.type_instance, type_instance,
sizeof(vl.type_instance));
- replace_special (vl.plugin_instance, sizeof (vl.plugin_instance));
+ replace_special (vl.type_instance, sizeof (vl.type_instance));
}
plugin_dispatch_values(&vl);
} /* }}} void submit */
xmlFree (zone_name);
zone_name = NULL;
- if (j >= views->zones_num)
+ if (j >= view->zones_num)
return (0);
zone_name = view->zones[j];
for (i = 0; i < zone_nodes->nodesetval->nodeNr; i++)
{
- xmlNode *node;
-
node = zone_nodes->nodesetval->nodeTab[i];
assert (node != NULL);
if (tmp->name == NULL)
{
ERROR ("bind plugin: strdup failed.");
- free (tmp);
+ sfree (views);
return (-1);
}
return (-1);
}
+ sfree (url);
url = strdup (child->values[0].value.string);
} else if (strcasecmp ("OpCodes", child->key) == 0)
bind_config_set_bool ("OpCodes", &global_opcodes, child);
bind_config_add_view (child);
else if (strcasecmp ("ParseTime", child->key) == 0)
cf_util_get_boolean (child, &config_parse_time);
+ else if (strcasecmp ("Timeout", child->key) == 0)
+ cf_util_get_int (child, &timeout);
else
{
WARNING ("bind plugin: Unknown configuration option "
curl_easy_setopt (curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL);
curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt (curl, CURLOPT_MAXREDIRS, 50L);
+#ifdef HAVE_CURLOPT_TIMEOUT_MS
+ curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, (timeout >= 0) ?
+ (long) timeout : CDTIME_T_TO_MS(plugin_get_interval()));
+#endif
+
return (0);
} /* }}} int bind_init */