Allow interrupting dnssec-signzone during signing

The signal handler in the isc_loop would wait for all the work to finish
before interrupting the signing.  Add teardown handlers via
isc_loopmgr_teardown() to signal the assignwork() it should stop signing
and bail-out early.

NOTE: The dnssec-signzone binary still can't be interrupted during zone
loading, zone cleaning, nsec(3) chain generation or zone writing.  This
might get addressed in the future if it becomes a problem.
This commit is contained in:
Ondřej Surý
2023-01-12 21:44:31 +01:00
parent f5095e6c34
commit 53e835130e

View File

@@ -1544,6 +1544,13 @@ signapex(void) {
}
}
static void
abortwork(void *arg) {
UNUSED(arg);
atomic_store(&shuttingdown, true);
}
/*%
* Assigns a node to a worker thread. This is protected by the main task's
* lock.
@@ -3937,13 +3944,13 @@ main(int argc, char *argv[]) {
* processors if possible.
*/
isc_loopmgr_setup(loopmgr, assignwork, NULL);
isc_loopmgr_teardown(loopmgr, abortwork, NULL);
isc_loopmgr_run(loopmgr);
if (!atomic_load(&finished)) {
fatal("process aborted by user");
}
}
atomic_store(&shuttingdown, true);
postsign();
TIME_NOW(&sign_finish);