diff options
author | Shawn Routhier <sar@isc.org> | 2013-11-14 12:55:10 -0800 |
---|---|---|
committer | Shawn Routhier <sar@isc.org> | 2013-11-14 12:55:10 -0800 |
commit | 0895c955d16a957107771e442397c6260d92cbc2 (patch) | |
tree | beb3d593cb202f75f92bad953fb1eaef1a875671 /common/dispatch.c | |
parent | f88446f16b9b3be36492f78b0f66a4166e459896 (diff) | |
download | isc-dhcp-0895c955d16a957107771e442397c6260d92cbc2.tar.gz |
[master] Fix up the gentle shutdown code to handle failover
This patch modifies the gentle failover patch to
be cleaner and to handle failover peers better.
Diffstat (limited to 'common/dispatch.c')
-rw-r--r-- | common/dispatch.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/common/dispatch.c b/common/dispatch.c index 976d37e2..c75a003b 100644 --- a/common/dispatch.c +++ b/common/dispatch.c @@ -110,17 +110,29 @@ dispatch(void) { isc_result_t status; - status = isc_app_ctxrun(dhcp_gbl_ctx.actx); + do { + status = isc_app_ctxrun(dhcp_gbl_ctx.actx); - /* - * isc_app_ctxrun can be stopped by receiving a signal. It will - * return ISC_R_SUCCESS in that case. That is a normal behavior. - */ + /* + * isc_app_ctxrun can be stopped by receiving a + * signal. It will return ISC_R_RELOAD in that + * case. That is a normal behavior. + */ - if (status != ISC_R_SUCCESS) { - log_fatal ("Dispatch routine failed: %s -- exiting", - isc_result_totext (status)); - } + if (status == ISC_R_RELOAD) { + /* + * dhcp_set_control_state() will do the job. + * Note its first argument is ignored. + */ + status = dhcp_set_control_state(server_shutdown, + server_shutdown); + if (status == ISC_R_SUCCESS) + status = ISC_R_RELOAD; + } + } while (status == ISC_R_RELOAD); + + log_fatal ("Dispatch routine failed: %s -- exiting", + isc_result_totext (status)); } void |