[PATCH] Cache messaging dgm connections

Jeremy Allison jra at samba.org
Thu Sep 15 17:09:18 UTC 2016


On Thu, Sep 15, 2016 at 06:38:25PM +0200, Ralph Böhme wrote:
> 
> I got one through with these two patches. Running more...
> 
> Cheerio!

Oh, this looks more elegant than the reparent struct poll_funcs_tevent_context
to ev patch I just posted...

The:

 +     TALLOC_FREE(msg->msg_dgm_ref);

looks very clever :-).

> From 6cf896a87057972afcc24cb6ed42fa588a325b7b Mon Sep 17 00:00:00 2001
> From: Ralph Boehme <slow at samba.org>
> Date: Thu, 15 Sep 2016 14:19:27 +0200
> Subject: [PATCH 1/2] lib/poll_funcs: free timers in
>  poll_funcs_state_destructor()
> 
> Signed-off-by: Ralph Boehme <slow at samba.org>
> ---
>  lib/poll_funcs/poll_funcs_tevent.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/lib/poll_funcs/poll_funcs_tevent.c b/lib/poll_funcs/poll_funcs_tevent.c
> index 3059ebc..3d79b75 100644
> --- a/lib/poll_funcs/poll_funcs_tevent.c
> +++ b/lib/poll_funcs/poll_funcs_tevent.c
> @@ -474,6 +474,7 @@ struct poll_funcs *poll_funcs_init_tevent(TALLOC_CTX *mem_ctx)
>  static int poll_funcs_state_destructor(struct poll_funcs_state *state)
>  {
>  	size_t num_watches = talloc_array_length(state->watches);
> +	size_t num_timeouts = talloc_array_length(state->timeouts);
>  	size_t i;
>  	/*
>  	 * Make sure the watches are cleared before the contexts. The watches
> @@ -482,6 +483,9 @@ static int poll_funcs_state_destructor(struct poll_funcs_state *state)
>  	for (i=0; i<num_watches; i++) {
>  		TALLOC_FREE(state->watches[i]);
>  	}
> +	for (i=0; i<num_timeouts; i++) {
> +		TALLOC_FREE(state->timeouts[i]);
> +	}
>  	return 0;
>  }
>  
> -- 
> 2.7.4
> 
> 
> From ad120b23821cba4c72354fbf4f73357c320e3c73 Mon Sep 17 00:00:00 2001
> From: Ralph Boehme <slow at samba.org>
> Date: Thu, 15 Sep 2016 14:19:51 +0200
> Subject: [PATCH 2/2] s4/messaging: let the imessaging ctx destructor free
>  msg_dgm_ref
> 
> Signed-off-by: Ralph Boehme <slow at samba.org>
> ---
>  source4/lib/messaging/messaging.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
> index fe052fbe..8c98254 100644
> --- a/source4/lib/messaging/messaging.c
> +++ b/source4/lib/messaging/messaging.c
> @@ -304,6 +304,7 @@ struct imessaging_context *msg_ctxs;
>  static int imessaging_context_destructor(struct imessaging_context *msg)
>  {
>  	DLIST_REMOVE(msg_ctxs, msg);
> +	TALLOC_FREE(msg->msg_dgm_ref);
>  	return 0;
>  }
>  
> -- 
> 2.7.4
> 




More information about the samba-technical mailing list