X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fnetwork.c;h=a659189f3e7960d312d0d608f9f8af55d1e3c5bb;hb=acbd25344a59c091b087311804d375b759077e32;hp=c81d7110664da7d5217d07cc4e3076fc55eec640;hpb=09c6d16ffba1b1b15e50579bbcf663f05f630932;p=collectd.git diff --git a/src/network.c b/src/network.c index c81d7110..a659189f 100644 --- a/src/network.c +++ b/src/network.c @@ -682,6 +682,16 @@ static int network_set_ttl (const sockent_t *se, const struct addrinfo *ai) static int network_bind_socket (const sockent_t *se, const struct addrinfo *ai) { int loop = 0; + int yes = 1; + + /* allow multiple sockets to use the same PORT number */ + if (setsockopt(se->fd, SOL_SOCKET, SO_REUSEADDR, + &yes, sizeof(yes)) == -1) { + char errbuf[1024]; + ERROR ("setsockopt: %s", + sstrerror (errno, errbuf, sizeof (errbuf))); + return (-1); + } DEBUG ("fd = %i; calling `bind'", se->fd); @@ -1107,8 +1117,6 @@ static int add_to_buffer (char *buffer, int buffer_size, (uint64_t) vl->interval)) return (-1); vl_def->interval = vl->interval; - DEBUG ("network plugin: add_to_buffer: interval = %i", - (int) vl->interval); } if (strcmp (vl_def->plugin, vl->plugin) != 0)