diff --git a/src/network.c b/src/network.c
index 34385bf66d106be5ebda3cf92a3ae88ad9d2adb6..21b969406907787230f173b2f2faeba5a3b6e20a 100644 (file)
--- a/src/network.c
+++ b/src/network.c
static char send_buffer[BUFF_SIZE];
static char *send_buffer_ptr;
static int send_buffer_fill;
-static value_list_t send_buffer_vl = VALUE_LIST_INIT;
+static value_list_t send_buffer_vl = VALUE_LIST_STATIC;
static char send_buffer_type[DATA_MAX_NAME_LEN];
static pthread_mutex_t send_buffer_lock = PTHREAD_MUTEX_INITIALIZER;
if (status == 0)
vl.time = (time_t) tmp;
}
+ else if (ntohs (header->type) == TYPE_INTERVAL)
+ {
+ uint64_t tmp = 0;
+ status = parse_part_number (&buffer, &buffer_len, &tmp);
+ if (status == 0)
+ vl.interval = (int) tmp;
+ }
else if (ntohs (header->type) == TYPE_HOST)
{
status = parse_part_string (&buffer, &buffer_len,
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)
(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 (write_part_number (&buffer, &buffer_size, TYPE_INTERVAL,
+ (uint64_t) vl->interval))
+ return (-1);
+ vl_def->interval = vl->interval;
}
if (strcmp (vl_def->plugin, vl->plugin) != 0)
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)
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)
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)
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)
&& (fields_num != 2))
return (1);
else if (fields_num == 2)
+ {
+ if ((service = strchr (fields[1], '.')) != NULL)
+ *service = '\0';
service = fields[1];
+ }
node = fields[0];
if (strcasecmp ("Listen", key) == 0)
static int network_shutdown (void)
{
- DEBUG ("Shutting down.");
-
listen_loop++;
if (listen_thread != (pthread_t) 0)
listen_thread = (pthread_t) 0;
}
- listen_thread = 0;
+ if (send_buffer_fill > 0)
+ flush_buffer ();
if (cache_tree != NULL)
{