From e8a0bc2131d7a48097a486577fa8263466fbe0c9 Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 30 Jan 2024 11:15:05 +0000 Subject: [PATCH] In the previous commit idle connections are reinserted onto the active list when the connection is closed. Since active connections are processed after idle ones this will trigger a "timeout, connection closed" warning. Work around this by clearing io_time in the close case of idle connections and checking for this in the active connection case. Problem noticed and OK job@ --- usr.sbin/rpki-client/http.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.sbin/rpki-client/http.c b/usr.sbin/rpki-client/http.c index 08dbaff73b6..282487aa1e3 100644 --- a/usr.sbin/rpki-client/http.c +++ b/usr.sbin/rpki-client/http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http.c,v 1.79 2024/01/30 10:16:13 claudio Exp $ */ +/* $OpenBSD: http.c,v 1.80 2024/01/30 11:15:05 claudio Exp $ */ /* * Copyright (c) 2020 Nils Fisher * Copyright (c) 2020 Claudio Jeker @@ -2160,8 +2160,10 @@ proc_http(char *bind_addr, int fd) LIST_FOREACH_SAFE(conn, &idle, entry, nc) { if (conn->pfd != NULL && conn->pfd->revents != 0) http_do(conn, http_handle); - else if (conn->idle_time <= now) + else if (conn->idle_time <= now) { + conn->io_time = 0; http_do(conn, http_close); + } if (conn->state == STATE_FREE) http_free(conn); @@ -2172,7 +2174,7 @@ proc_http(char *bind_addr, int fd) /* check if event is ready */ if (conn->pfd != NULL && conn->pfd->revents != 0) http_do(conn, http_handle); - else if (conn->io_time <= now) { + else if (conn->io_time != 0 && conn->io_time <= now) { conn->io_time = 0; if (conn->state == STATE_CONNECT) { warnx("%s: connect timeout", -- 2.20.1