summaryrefslogtreecommitdiff
path: root/usr.sbin/rpki-client/main.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2022-09-02 21:56:46 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2022-09-02 21:56:46 +0000
commit06a4edb49a3c27839962fc3553d3abfcf81472e9 (patch)
treeeb82242c7168addf078aa93fefd89a365f225579 /usr.sbin/rpki-client/main.c
parent3f9e2bd8412a498ffb6ec93fe4933112f570caf1 (diff)
Introduce a deadline timer that aborts all repository syncs.
With this rpki-client has a chance to still finish and produce an output even when a CA is excessivly slow and holds back progress. With and OK benno@ tb@ and job@
Diffstat (limited to 'usr.sbin/rpki-client/main.c')
-rw-r--r--usr.sbin/rpki-client/main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c
index 4a60208c6da..f5e5ab31254 100644
--- a/usr.sbin/rpki-client/main.c
+++ b/usr.sbin/rpki-client/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.217 2022/09/02 19:14:04 claudio Exp $ */
+/* $OpenBSD: main.c,v 1.218 2022/09/02 21:56:45 claudio Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -66,6 +66,7 @@ int noop;
int filemode;
int rrdpon = 1;
int repo_timeout;
+time_t deadline;
struct skiplist skiplist = LIST_HEAD_INITIALIZER(skiplist);
@@ -1044,6 +1045,10 @@ main(int argc, char *argv[])
*/
alarm(timeout);
signal(SIGALRM, suicide);
+
+ /* give up a bit before the hard timeout and try to finish up */
+ if (!noop)
+ deadline = getmonotime() + timeout - repo_timeout / 2;
}
if (pledge("stdio rpath wpath cpath fattr sendfd unveil", NULL) == -1)