From 7cb76e55803ed5d640f9636585dc2ce0f37b094e Mon Sep 17 00:00:00 2001 From: job Date: Thu, 15 Aug 2024 11:30:43 +0000 Subject: [PATCH] Ensure synchronization jobs are stopped when the timeout is reached OK tb@ claudio@ --- usr.sbin/rpki-client/repo.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/usr.sbin/rpki-client/repo.c b/usr.sbin/rpki-client/repo.c index ce97015aedf..0d6777792c7 100644 --- a/usr.sbin/rpki-client/repo.c +++ b/usr.sbin/rpki-client/repo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: repo.c,v 1.61 2024/07/12 09:27:32 claudio Exp $ */ +/* $OpenBSD: repo.c,v 1.62 2024/08/15 11:30:43 job Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -1376,12 +1376,15 @@ repo_abort(struct repo *rp) /* reset the alarm */ rp->alarm = getmonotime() + repo_timeout; - if (rp->rsync) + if (rp->rsync) { + warnx("%s: synchronisation timeout", rp->repouri); rsync_abort(rp->rsync->id); - else if (rp->rrdp) + } else if (rp->rrdp) { + warnx("%s: synchronisation timeout", rp->notifyuri); rrdp_abort(rp->rrdp->id); - else - repo_fail(rp); + } + + repo_fail(rp); } int @@ -1412,11 +1415,9 @@ repo_check_timeout(int timeout) /* Look up in repository table. (Lookup should actually fail here) */ SLIST_FOREACH(rp, &repos, entry) { if (repo_state(rp) == REPO_LOADING) { - if (rp->alarm <= now) { - warnx("%s: synchronisation timeout", - rp->repouri); + if (rp->alarm <= now) repo_abort(rp); - } else { + else { diff = rp->alarm - now; diff *= 1000; if (timeout == INFTIM || diff < timeout) -- 2.20.1