From dd025b4cbd501e2f34461f9d8359a829b81f5c2f Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Tue, 27 Apr 2010 14:57:37 -0400 Subject: Add callback when the ID provider switches from offline to online Allow backends to set a callback in the be_ctx that should be invoked when the ID provider goes online. This can be used to perform regular maintenance tasks that are valid only when going online. --- src/providers/proxy.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/providers/proxy.c') diff --git a/src/providers/proxy.c b/src/providers/proxy.c index c7aef3086..ac5cf7fe9 100644 --- a/src/providers/proxy.c +++ b/src/providers/proxy.c @@ -277,6 +277,16 @@ static void proxy_pam_handler(struct be_req *req) { static void proxy_reply(struct be_req *req, int dp_err, int error, const char *errstr) { + if (!req->be_ctx->offstat.offline) { + /* This action took place online. + * Fire any online callbacks if necessary. + * Note: we're checking the offline value directly, + * because if the activity took a long time to + * complete, calling be_is_offline() might report false + * incorrectly. + */ + be_run_online_cb(req->be_ctx); + } return req->fn(req, dp_err, error, errstr); } -- cgit