summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dbf45db)
raw | patch | inline | side by side (parent: dbf45db)
author | J. Javier Maestro <jjmaestro@ieee.org> | |
Sun, 16 Jun 2013 17:37:32 +0000 (19:37 +0200) | ||
committer | J. Javier Maestro <jjmaestro@ieee.org> | |
Sun, 16 Jun 2013 17:37:32 +0000 (19:37 +0200) |
Moving the protocol error checking from `wg_callback_init` to `wg_config_node`.
This avoids flooding the log, as suggested by Florian Forster (@octo).
This avoids flooding the log, as suggested by Florian Forster (@octo).
src/write_graphite.c | patch | blob | history |
diff --git a/src/write_graphite.c b/src/write_graphite.c
index c264932f5e52ec71a4083fdfdf3be3b2652af074..c1a11df2d0911175b3b512fa21829c7d2139b68f 100644 (file)
--- a/src/write_graphite.c
+++ b/src/write_graphite.c
if (0 == strcasecmp ("tcp", protocol))
ai_hints.ai_socktype = SOCK_STREAM;
- else if (0 == strcasecmp ("udp", protocol))
- ai_hints.ai_socktype = SOCK_DGRAM;
else
- {
- ERROR ("write_graphite plugin: unknown protocol (%s)",
- protocol);
- return (-1);
- }
+ ai_hints.ai_socktype = SOCK_DGRAM;
ai_list = NULL;
else if (strcasecmp ("Port", child->key) == 0)
cf_util_get_service (child, &cb->service);
else if (strcasecmp ("Protocol", child->key) == 0)
+ {
cf_util_get_string (child, &cb->protocol);
+
+ if (strcasecmp ("UDP", cb->protocol) != 0 &&
+ strcasecmp ("TCP", cb->protocol) != 0)
+ {
+ ERROR ("write_graphite plugin: Unknown protocol (%s)",
+ cb->protocol);
+ status = -1;
+ }
+ }
else if (strcasecmp ("LogSendErrors", child->key) == 0)
cf_util_get_boolean (child, &cb->log_send_errors);
else if (strcasecmp ("Prefix", child->key) == 0)