then just failing the repo fetch but leaving the backends running.
OK tb@
-/* $OpenBSD: extern.h,v 1.152 2022/09/02 18:37:17 claudio Exp $ */
+/* $OpenBSD: extern.h,v 1.153 2022/09/02 19:10:36 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
void rsync_fetch(unsigned int, const char *, const char *,
const char *);
+void rsync_abort(unsigned int);
void http_fetch(unsigned int, const char *, const char *, int);
void rrdp_fetch(unsigned int, const char *, const char *,
struct rrdp_session *);
+void rrdp_abort(unsigned int);
void rrdp_http_done(unsigned int, enum http_result, const char *);
int repo_check_timeout(int);
-/* $OpenBSD: main.c,v 1.215 2022/08/30 22:42:32 tb Exp $ */
+/* $OpenBSD: main.c,v 1.216 2022/09/02 19:10:37 claudio Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
io_close_buffer(&rrdpq, b);
}
+void
+rrdp_abort(unsigned int id)
+{
+ enum rrdp_msg type = RRDP_ABORT;
+ struct ibuf *b;
+
+ b = io_new_buffer();
+ io_simple_buffer(b, &type, sizeof(type));
+ io_simple_buffer(b, &id, sizeof(id));
+ io_close_buffer(&rrdpq, b);
+}
+
/*
* Request a repository sync via rsync URI to directory local.
*/
io_close_buffer(&rsyncq, b);
}
+void
+rsync_abort(unsigned int id)
+{
+ struct ibuf *b;
+
+ b = io_new_buffer();
+ io_simple_buffer(b, &id, sizeof(id));
+ io_str_buffer(b, NULL);
+ io_str_buffer(b, NULL);
+ io_str_buffer(b, NULL);
+ io_close_buffer(&rsyncq, b);
+}
+
/*
* Request a file from a https uri, data is written to the file descriptor fd.
*/
-/* $OpenBSD: repo.c,v 1.37 2022/09/02 15:09:19 job Exp $ */
+/* $OpenBSD: repo.c,v 1.38 2022/09/02 19:10:37 claudio Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
errx(1, "%s: bad repo", rp->repouri);
}
+static void
+repo_abort(struct repo *rp)
+{
+ /* reset the alarm */
+ rp->alarm = getmonotime() + repo_timeout;
+
+ if (rp->rsync)
+ rsync_abort(rp->rsync->id);
+ else if (rp->rrdp)
+ rrdp_abort(rp->rrdp->id);
+ else
+ repo_fail(rp);
+}
+
int
repo_check_timeout(int timeout)
{
if (rp->alarm <= now) {
warnx("%s: synchronisation timeout",
rp->repouri);
- repo_fail(rp);
+ repo_abort(rp);
} else {
int diff = rp->alarm - now;
diff *= 1000;