From 48b794525072b1ff00a90497ef0bb1f4030510f4 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 7 Jun 2008 20:39:04 +0200 Subject: [PATCH] network plugin: Don't blindly re-initialize everything in the init callback. Under Solaris the init functions are called every time the kstat chain is updated. Since, among other things, send_buffer_fill was set to zero here, the plugin ``forgot'' about values. Thank you very much to Eric LeBlanc for debugging this issue. --- src/network.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/network.c b/src/network.c index b67928c7..ff806af3 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; /* @@ -1706,11 +1706,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; -- 2.30.2