From 52a39100797a134041085093e7d0b6a7595b224e Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Fri, 19 Nov 2010 21:09:47 +0100 Subject: [PATCH] Add SIGUSR2 to reset offline status --- src/man/sssd.8.xml | 10 ++++++++++ src/monitor/monitor.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 0 deletions(-) diff --git a/src/man/sssd.8.xml b/src/man/sssd.8.xml index eaf37ca..f449de7 100644 --- a/src/man/sssd.8.xml +++ b/src/man/sssd.8.xml @@ -150,6 +150,16 @@ + + SIGUSR2 + + + Tells the SSSD to go online immediatly. This is mostly + useful for testing purposes but might also help if the + offline/online detection is not fast enough. + + + diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index 98b671b..3eca764 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -1266,6 +1266,27 @@ static void signal_offline(struct tevent_context *ev, } } +static void signal_offline_reset(struct tevent_context *ev, + struct tevent_signal *se, + int signum, + int count, + void *siginfo, + void *private_data) +{ + struct mt_ctx *monitor; + struct mt_svc *cur_svc; + + monitor = talloc_get_type(private_data, struct mt_ctx); + + DEBUG(8, ("Signaling providers to reset offline immediately.\n")); + + for(cur_svc = monitor->svc_list; cur_svc; cur_svc = cur_svc->next) { + if (cur_svc->provider) { + service_signal_reset_offline(cur_svc); + } + } +} + int read_config_file(const char *config_file) { int ret; @@ -1910,6 +1931,14 @@ int monitor_process_init(struct mt_ctx *ctx, return EIO; } + /* Handle SIGUSR2 (tell all providers to go reset offline) */ + BlockSignals(false, SIGUSR2); + tes = tevent_add_signal(ctx->ev, ctx, SIGUSR2, 0, + signal_offline_reset, ctx); + if (tes == NULL) { + return EIO; + } + return EOK; } -- 1.7.3.2