-/* $OpenBSD: extern.h,v 1.137 2022/05/11 21:19:06 job Exp $ */
+/* $OpenBSD: extern.h,v 1.138 2022/05/24 09:20:49 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
/* Maximum depth of the RPKI tree. */
#define MAX_CERT_DEPTH 12
-/* Maximum number of concurrent rsync processes. */
-#define MAX_RSYNC_PROCESSES 16
+/* Maximum number of concurrent http and rsync requests. */
+#define MAX_HTTP_REQUESTS 64
+#define MAX_RSYNC_REQUESTS 16
/* Maximum allowd repositories per tal */
#define MAX_REPO_PER_TAL 1000
-/* $OpenBSD: http.c,v 1.60 2022/05/15 16:43:34 tb Exp $ */
+/* $OpenBSD: http.c,v 1.61 2022/05/24 09:20:49 claudio Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
#define HTTP_BUF_SIZE (32 * 1024)
#define HTTP_IDLE_TIMEOUT 10
#define HTTP_IO_TIMEOUT (3 * 60)
-#define MAX_CONNECTIONS 64
#define MAX_CONTENTLEN (2 * 1024 * 1024 * 1024LL)
-#define NPFDS (MAX_CONNECTIONS + 1)
+#define NPFDS (MAX_HTTP_REQUESTS + 1)
enum res {
DONE,
return 1;
}
- if (http_conn_count < MAX_CONNECTIONS) {
+ if (http_conn_count < MAX_HTTP_REQUESTS) {
http_new(req);
return 1;
}
-/* $OpenBSD: rsync.c,v 1.37 2022/04/20 15:38:24 deraadt Exp $ */
+/* $OpenBSD: rsync.c,v 1.38 2022/05/24 09:20:49 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
struct msgbuf msgq;
struct ibuf *b, *inbuf = NULL;
sigset_t mask, oldmask;
- struct rsyncproc ids[MAX_RSYNC_PROCESSES] = { 0 };
+ struct rsyncproc ids[MAX_RSYNC_REQUESTS] = { 0 };
if (pledge("stdio rpath proc exec unveil", NULL) == -1)
err(1, "pledge");
int st;
pfd.events = 0;
- if (nprocs < MAX_RSYNC_PROCESSES)
+ if (nprocs < MAX_RSYNC_REQUESTS)
pfd.events |= POLLIN;
if (msgq.queued)
pfd.events |= POLLOUT;
while ((pid = waitpid(WAIT_ANY, &st, WNOHANG)) > 0) {
int ok = 1;
- for (i = 0; i < MAX_RSYNC_PROCESSES; i++)
+ for (i = 0; i < MAX_RSYNC_REQUESTS; i++)
if (ids[i].pid == pid)
break;
- if (i >= MAX_RSYNC_PROCESSES)
+ if (i >= MAX_RSYNC_REQUESTS)
errx(1, "waitpid: %d unexpected", pid);
if (!WIFEXITED(st)) {
if (!(pfd.revents & POLLIN))
continue;
- if (nprocs >= MAX_RSYNC_PROCESSES)
+ if (nprocs >= MAX_RSYNC_REQUESTS)
continue;
b = io_buf_read(fd, &inbuf);
/* Augment the list of running processes. */
- for (i = 0; i < MAX_RSYNC_PROCESSES; i++)
+ for (i = 0; i < MAX_RSYNC_REQUESTS; i++)
if (ids[i].pid == 0)
break;
- assert(i < MAX_RSYNC_PROCESSES);
+ assert(i < MAX_RSYNC_REQUESTS);
ids[i].id = id;
ids[i].pid = pid;
ids[i].uri = uri;
}
/* No need for these to be hanging around. */
- for (i = 0; i < MAX_RSYNC_PROCESSES; i++)
+ for (i = 0; i < MAX_RSYNC_REQUESTS; i++)
if (ids[i].pid != 0) {
kill(ids[i].pid, SIGTERM);
free(ids[i].uri);