X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnetwork.c;h=b6778fa0797444901b71364c4f8a559552349f3c;hb=e3bfada72a4942b8d516074b22028037e757cc0e;hp=6be7a09859cf0bd0b580c9ed540b00cc9fa3ed21;hpb=c28bc580c110c78741d0805c7652e05d994b0ff4;p=collectd.git diff --git a/src/network.c b/src/network.c index 6be7a098..b6778fa0 100644 --- a/src/network.c +++ b/src/network.c @@ -183,7 +183,7 @@ static pthread_mutex_t send_buffer_lock = PTHREAD_MUTEX_INITIALIZER; static c_avl_tree_t *cache_tree = NULL; static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER; -static time_t cache_flush_last; +static time_t cache_flush_last = 0; static int cache_flush_interval = 1800; /* @@ -1704,11 +1704,19 @@ static int network_shutdown (void) plugin_unregister_write ("network"); plugin_unregister_shutdown ("network"); + /* Let the init function do it's move again ;) */ + cache_flush_last = 0; + return (0); } /* int network_shutdown */ static int network_init (void) { + /* Check if we were already initialized. If so, just return - there's + * nothing more to do (for now, that is). */ + if (cache_flush_last != 0) + return (0); + plugin_register_shutdown ("network", network_shutdown); send_buffer_ptr = send_buffer;