-/* $OpenBSD: extern.h,v 1.113 2022/01/23 05:59:35 claudio Exp $ */
+/* $OpenBSD: extern.h,v 1.114 2022/01/23 12:09:24 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
void rrdp_fetch(unsigned int, const char *, const char *,
struct rrdp_session *);
void rrdp_http_done(unsigned int, enum http_result, const char *);
-
-int repo_next_timeout(int);
-void repo_check_timeout(void);
+int repo_check_timeout(int);
/* Logging (though really used for OpenSSL errors). */
-/* $OpenBSD: http.c,v 1.51 2021/12/22 09:35:14 claudio Exp $ */
+/* $OpenBSD: http.c,v 1.52 2022/01/23 12:09:24 claudio Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
errx(1, "too many connections");
}
- if (poll(pfds, i, timeout) == -1)
+ if (poll(pfds, i, timeout) == -1) {
+ if (errno == EINTR)
+ continue;
err(1, "poll");
+ }
if (pfds[0].revents & POLLHUP)
break;
-/* $OpenBSD: main.c,v 1.182 2022/01/23 07:21:12 claudio Exp $ */
+/* $OpenBSD: main.c,v 1.183 2022/01/23 12:09:24 claudio Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
pfd[i].events |= POLLOUT;
}
- polltim = repo_next_timeout(INFTIM);
+ polltim = repo_check_timeout(INFTIM);
if ((c = poll(pfd, NPFD, polltim)) == -1) {
if (errno == EINTR)
if (hangup)
break;
- repo_check_timeout();
-
/*
* Check the rsync and http process.
* This means that one of our modules has completed
-/* $OpenBSD: parser.c,v 1.52 2022/01/23 07:21:12 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.53 2022/01/23 12:09:24 claudio Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
if (msgq.queued)
pfd.events |= POLLOUT;
- if (poll(&pfd, 1, INFTIM) == -1)
+ if (poll(&pfd, 1, INFTIM) == -1) {
+ if (errno == EINTR)
+ continue;
err(1, "poll");
+ }
if ((pfd.revents & (POLLERR|POLLNVAL)))
errx(1, "poll: bad descriptor");
-/* $OpenBSD: repo.c,v 1.25 2022/01/14 15:00:23 claudio Exp $ */
+/* $OpenBSD: repo.c,v 1.26 2022/01/23 12:09:24 claudio Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
return 0;
}
-int
-repo_next_timeout(int timeout)
-{
- struct repo *rp;
- time_t now;
-
- now = getmonotime();
- /* Look up in repository table. (Lookup should actually fail here) */
- SLIST_FOREACH(rp, &repos, entry) {
- if (repo_state(rp) == REPO_LOADING) {
- int diff = rp->alarm - now;
- if (diff < 0)
- diff = 0;
- diff *= 1000;
- if (timeout == INFTIM || diff < timeout)
- timeout = diff;
- }
- }
- return timeout;
-}
-
static void
repo_fail(struct repo *rp)
{
errx(1, "%s: bad repo", rp->repouri);
}
-void
-repo_check_timeout(void)
+int
+repo_check_timeout(int timeout)
{
struct repo *rp;
time_t now;
warnx("%s: synchronisation timeout",
rp->repouri);
repo_fail(rp);
+ } else {
+ int diff = rp->alarm - now;
+ diff *= 1000;
+ if (timeout == INFTIM || diff < timeout)
+ timeout = diff;
}
}
}
+ return timeout;
}
static char **
-/* $OpenBSD: rrdp.c,v 1.20 2022/01/13 13:18:41 claudio Exp $ */
+/* $OpenBSD: rrdp.c,v 1.21 2022/01/23 12:09:24 claudio Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
if (msgq.queued)
pfds[0].events |= POLLOUT;
- if (poll(pfds, i, INFTIM) == -1)
+ if (poll(pfds, i, INFTIM) == -1) {
+ if (errno == EINTR)
+ continue;
err(1, "poll");
+ }
if (pfds[0].revents & POLLHUP)
break;