[PATCH 4/4] nerd: Fix subscriptions after config reload

robin.sonefors at op5.com robin.sonefors at op5.com
Tue Nov 27 17:41:52 CET 2012


From: Robin Sonefors <robin.sonefors at op5.com>

We didn't clean up the channels completely during shutdown, so in a
reload, we'd append the channels created during startup after the old,
stale ones. The old ones no longer did anything, and when trying to
subscribe to the new ones, we'd end up subscribing to the old ones.

Signed-off-by: Robin Sonefors <robin.sonefors at op5.com>
---
 base/nerd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/base/nerd.c b/base/nerd.c
index e0cf6a5..81a5236 100644
--- a/base/nerd.c
+++ b/base/nerd.c
@@ -41,7 +41,7 @@ struct subscription {
 
 static nebmodule nerd_mod; /* fake module to get our callbacks accepted */
 static struct nerd_channel **channels;
-static unsigned int num_channels, alloc_channels;
+static unsigned int num_channels = 0, alloc_channels = 0;
 static unsigned int chan_host_checks_id, chan_service_checks_id;
 static unsigned int chan_opath_checks_id;
 
@@ -357,6 +357,9 @@ static int nerd_deinit(void)
 		}
 		chan->subscriptions = NULL;
 	}
+	my_free(channels);
+	num_channels = 0;
+	alloc_channels = 0;
 
 	return 0;
 }
-- 
1.7.11.7


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov




More information about the Developers mailing list