Code

src/utils_threshold.c: Corrected and improved the handling of the `invert' setting.
[collectd.git] / src / network.c
index c81d7110664da7d5217d07cc4e3076fc55eec640..a659189f3e7960d312d0d608f9f8af55d1e3c5bb 100644 (file)
@@ -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)