From: claudio Date: Tue, 21 Dec 2021 16:16:15 +0000 (+0000) Subject: Simplify code a bit. There is only one TA per TAL and so only one X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=578d50dbc4973192a72f85036316a72513ba2de4;p=openbsd Simplify code a bit. There is only one TA per TAL and so only one ta_lookup(). Implementing the talrepocnt limiter there makes little sense and gains us nothing. OK job@ --- diff --git a/usr.sbin/rpki-client/repo.c b/usr.sbin/rpki-client/repo.c index 3a5a32eb7a7..a9badbfeab1 100644 --- a/usr.sbin/rpki-client/repo.c +++ b/usr.sbin/rpki-client/repo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: repo.c,v 1.15 2021/12/07 12:46:47 claudio Exp $ */ +/* $OpenBSD: repo.c,v 1.16 2021/12/21 16:16:15 claudio Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -381,7 +381,7 @@ ta_fetch(struct tarepo *tr) } static struct tarepo * -ta_get(struct tal *tal, int nofetch) +ta_get(struct tal *tal) { struct tarepo *tr; @@ -405,7 +405,7 @@ ta_get(struct tal *tal, int nofetch) tal->urisz = 0; tal->uri = NULL; - if (noop || nofetch) { + if (noop) { tr->state = REPO_DONE; logx("ta/%s: using cache", tr->descr); /* there is nothing in the queue so no need to flush */ @@ -1087,7 +1087,6 @@ struct repo * ta_lookup(int id, struct tal *tal) { struct repo *rp; - int nofetch = 0; /* Look up in repository table. (Lookup should actually fail here) */ SLIST_FOREACH(rp, &repos, entry) { @@ -1099,13 +1098,7 @@ ta_lookup(int id, struct tal *tal) if ((rp->repouri = strdup(tal->descr)) == NULL) err(1, NULL); - if (++talrepocnt[id] >= MAX_REPO_PER_TAL) { - if (talrepocnt[id] == MAX_REPO_PER_TAL) - warnx("too many repositories under %s", tals[id]); - nofetch = 1; - } - - rp->ta = ta_get(tal, nofetch); + rp->ta = ta_get(tal); return rp; }