diff --git a/src/network.c b/src/network.c
index b0f8303f552a37e16c06ebd2b147bb87a90f8a49..a659189f3e7960d312d0d608f9f8af55d1e3c5bb 100644 (file)
--- a/src/network.c
+++ b/src/network.c
static int network_bind_socket (const sockent_t *se, const struct addrinfo *ai)
{
int loop = 0;
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);
DEBUG ("fd = %i; calling `bind'", se->fd);
vl->host, strlen (vl->host)) != 0)
return (-1);
strcpy (vl_def->host, vl->host);
vl->host, strlen (vl->host)) != 0)
return (-1);
strcpy (vl_def->host, vl->host);
- DEBUG ("network plugin: add_to_buffer: host = %s", vl->host);
}
if (vl_def->time != vl->time)
}
if (vl_def->time != vl->time)
(uint64_t) vl->time))
return (-1);
vl_def->time = vl->time;
(uint64_t) vl->time))
return (-1);
vl_def->time = vl->time;
- DEBUG ("network plugin: add_to_buffer: time = %u",
- (unsigned int) vl->time);
}
if (vl_def->interval != vl->interval)
}
if (vl_def->interval != vl->interval)
(uint64_t) vl->interval))
return (-1);
vl_def->interval = vl->interval;
(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)
}
if (strcmp (vl_def->plugin, vl->plugin) != 0)
vl->plugin, strlen (vl->plugin)) != 0)
return (-1);
strcpy (vl_def->plugin, vl->plugin);
vl->plugin, strlen (vl->plugin)) != 0)
return (-1);
strcpy (vl_def->plugin, vl->plugin);
- DEBUG ("network plugin: add_to_buffer: plugin = %s",
- vl->plugin);
}
if (strcmp (vl_def->plugin_instance, vl->plugin_instance) != 0)
}
if (strcmp (vl_def->plugin_instance, vl->plugin_instance) != 0)
strlen (vl->plugin_instance)) != 0)
return (-1);
strcpy (vl_def->plugin_instance, vl->plugin_instance);
strlen (vl->plugin_instance)) != 0)
return (-1);
strcpy (vl_def->plugin_instance, vl->plugin_instance);
- DEBUG ("network plugin: add_to_buffer: plugin_instance = %s",
- vl->plugin_instance);
}
if (strcmp (type_def, ds->type) != 0)
}
if (strcmp (type_def, ds->type) != 0)
ds->type, strlen (ds->type)) != 0)
return (-1);
strcpy (type_def, ds->type);
ds->type, strlen (ds->type)) != 0)
return (-1);
strcpy (type_def, ds->type);
- DEBUG ("network plugin: add_to_buffer: type = %s", ds->type);
}
if (strcmp (vl_def->type_instance, vl->type_instance) != 0)
}
if (strcmp (vl_def->type_instance, vl->type_instance) != 0)
strlen (vl->type_instance)) != 0)
return (-1);
strcpy (vl_def->type_instance, vl->type_instance);
strlen (vl->type_instance)) != 0)
return (-1);
strcpy (vl_def->type_instance, vl->type_instance);
- DEBUG ("network plugin: add_to_buffer: type_instance = %s",
- vl->type_instance);
}
if (write_part_values (&buffer, &buffer_size, ds, vl) != 0)
}
if (write_part_values (&buffer, &buffer_size, ds, vl) != 0)
static int network_shutdown (void)
{
static int network_shutdown (void)
{
- DEBUG ("Shutting down.");
-
listen_loop++;
if (listen_thread != (pthread_t) 0)
listen_loop++;
if (listen_thread != (pthread_t) 0)
listen_thread = (pthread_t) 0;
}
listen_thread = (pthread_t) 0;
}
- listen_thread = 0;
+ if (send_buffer_fill > 0)
+ flush_buffer ();
if (cache_tree != NULL)
{
if (cache_tree != NULL)
{