From 3bd78eb2faf09635b8d307e4440ccb1420f80716 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Sun, 19 May 2013 17:36:54 +0200 Subject: Fix dyndns timer initialization The dyndns init function was starting the timer even if the updates were set to False. This patch splits the init of dynamic updates and the timer into two functions so that the back end can start the updates separately from reading the options. --- src/providers/dp_dyndns.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/providers/dp_dyndns.c') diff --git a/src/providers/dp_dyndns.c b/src/providers/dp_dyndns.c index 8cf42443..1b710b55 100644 --- a/src/providers/dp_dyndns.c +++ b/src/providers/dp_dyndns.c @@ -1181,8 +1181,6 @@ static struct dp_option default_dyndns_opts[] = { errno_t be_nsupdate_init(TALLOC_CTX *mem_ctx, struct be_ctx *be_ctx, struct dp_option *defopts, - nsupdate_timer_fn_t timer_callback, - void *timer_pvt, struct be_nsupdate_ctx **_ctx) { errno_t ret; @@ -1212,10 +1210,20 @@ be_nsupdate_init(TALLOC_CTX *mem_ctx, struct be_ctx *be_ctx, return EINVAL; } + *_ctx = ctx; + return ERR_OK; +} + +errno_t be_nsupdate_init_timer(struct be_nsupdate_ctx *ctx, + struct tevent_context *ev, + nsupdate_timer_fn_t timer_callback, + void *timer_pvt) +{ + if (ctx == NULL) return EINVAL; + ctx->timer_callback = timer_callback; ctx->timer_pvt = timer_pvt; - be_nsupdate_timer_schedule(be_ctx->ev, ctx); + be_nsupdate_timer_schedule(ev, ctx); - *_ctx = ctx; return ERR_OK; } -- cgit