From: Tomas Volf <~@wolfsden.cz> Subject: [PATCH] acme-client: netproc.c: Sleep before updating the order. To: tech@openbsd.org Cc: Tomas Volf <~@wolfsden.cz> Date: Fri, 5 Jul 2024 17:03:22 +0200 Since we are waiting for the CA to perform some actions, it makes more sense to sleep before checking for update, not after. The behavior should be pretty much the same, expect it should allows us to sleep once less in some situations. * usr.sbin/acme-client/netproc.c (netproc): Move sleep before call to doupdorder. Unify sleeps for ORDER_PENDING and ORDER_PROCESSING. --- This patch is optional. Does not fix any bug, it just (possibly) removes one extra loop (sleep). usr.sbin/acme-client/netproc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/usr.sbin/acme-client/netproc.c b/usr.sbin/acme-client/netproc.c index 4c3069898b1..7b9a4db4a25 100644 --- a/usr.sbin/acme-client/netproc.c +++ b/usr.sbin/acme-client/netproc.c @@ -840,7 +840,6 @@ netproc(int kfd, int afd, int Cfd, int cfd, int dfd, int rfd, * CA began the issuance process. Nothing to do but * wait. */ - sleep(RETRY_DELAY); break; case ORDER_READY: /* @@ -861,12 +860,14 @@ netproc(int kfd, int afd, int Cfd, int cfd, int dfd, int rfd, warnx("unhandled status: %d", order.status); goto out; } - if (!doupdorder(&c, &order)) - goto out; dodbg("order.status %d", order.status); - if (order.status == ORDER_PENDING) + if (order.status == ORDER_PENDING + || order.status == ORDER_PROCESSING) sleep(RETRY_DELAY); + + if (!doupdorder(&c, &order)) + goto out; } if (order.status != ORDER_VALID) { -- 2.45.1