[PATCH 4/4] nerd: Fix subscriptions after config reload
Andreas Ericsson
ae at op5.se
Wed Nov 28 13:11:21 CET 2012
On 11/27/2012 05:41 PM, robin.sonefors at op5.com wrote:
> 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;
>
Good catch.
Applied. Thanks.
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net
More information about the Developers
mailing list