X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fstatsd.c;h=9050596f9d3f1894830d479a4d8d09bed27c4c22;hp=6fbfd181fd6f418cc7dec715d16fc7b2f6d64e31;hb=0e73c26f5670b2f11eecfdadaf545bcc7f260658;hpb=a9191cc20f0a5af022ae1d9482af2eaf0098a46a diff --git a/src/statsd.c b/src/statsd.c index 6fbfd181..9050596f 100644 --- a/src/statsd.c +++ b/src/statsd.c @@ -26,10 +26,10 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" -#include "utils_avltree.h" -#include "utils_latency.h" +#include "utils/avltree/avltree.h" +#include "utils/common/common.h" +#include "utils/latency/latency.h" #include #include @@ -498,6 +498,14 @@ static int statsd_network_init(struct pollfd **ret_fds, /* {{{ */ continue; } + /* allow multiple sockets to use the same PORT number */ + int yes = 1; + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) == -1) { + ERROR("statsd plugin: setsockopt (reuseaddr): %s", STRERRNO); + close(fd); + continue; + } + getnameinfo(ai_ptr->ai_addr, ai_ptr->ai_addrlen, str_node, sizeof(str_node), str_service, sizeof(str_service), NI_DGRAM | NI_NUMERICHOST | NI_NUMERICSERV); @@ -525,6 +533,7 @@ static int statsd_network_init(struct pollfd **ret_fds, /* {{{ */ memset(tmp, 0, sizeof(*tmp)); tmp->fd = fd; tmp->events = POLLIN | POLLPRI; + INFO("statsd plugin: Listening on [%s]:%s.", str_node, str_service); } freeaddrinfo(ai_list); @@ -597,9 +606,8 @@ static int statsd_config_timer_percentile(oconfig_item_t *ci) /* {{{ */ return ERANGE; } - tmp = - realloc(conf_timer_percentile, - sizeof(*conf_timer_percentile) * (conf_timer_percentile_num + 1)); + tmp = realloc(conf_timer_percentile, sizeof(*conf_timer_percentile) * + (conf_timer_percentile_num + 1)); if (tmp == NULL) { ERROR("statsd plugin: realloc failed."); return ENOMEM;