git: ae12f0f08e02 - stable/15 - libfetch: Restore timeout functionality
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 18 Feb 2026 18:39:12 UTC
The branch stable/15 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=ae12f0f08e02804f5f2e70a0558c39a2cb4c5b23
commit ae12f0f08e02804f5f2e70a0558c39a2cb4c5b23
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-02-18 15:10:47 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-02-18 18:38:48 +0000
libfetch: Restore timeout functionality
PR: 293124
MFC after: 1 week
Fixes: 792ef1ae7b94 ("Refactor fetch_connect() and fetch_bind() to improve readability and avoid repeating the same DNS lookups.")
Reverts: 8f8a7f6fffd7 ("libfetch: apply timeout to SSL_read()")
Reviewed by: eugen, imp
Differential Revision: https://reviews.freebsd.org/D55293
(cherry picked from commit 73b82d1b0a2f09224e6d0f7a13dd73c66d740207)
(insta-mfc requested by re@)
---
lib/libfetch/common.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c
index 584973476068..f679b2afc95c 100644
--- a/lib/libfetch/common.c
+++ b/lib/libfetch/common.c
@@ -286,6 +286,9 @@ fetch_reopen(int sd)
flags = fcntl(sd, F_GETFD);
if (flags != -1 && (flags & FD_CLOEXEC) == 0)
(void)fcntl(sd, F_SETFD, flags | FD_CLOEXEC);
+ flags = fcntl(sd, F_GETFL);
+ if (flags != -1 && (flags & O_NONBLOCK) == 0)
+ (void)fcntl(sd, F_SETFL, flags | O_NONBLOCK);
(void)setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt));
conn->sd = sd;
++conn->ref;
@@ -1271,14 +1274,6 @@ fetch_ssl_read(SSL *ssl, char *buf, size_t len)
{
ssize_t rlen;
int ssl_err;
- struct timeval tv;
-
- if (fetchTimeout > 0) {
- tv.tv_sec = fetchTimeout;
- tv.tv_usec = 0;
- setsockopt(SSL_get_fd(ssl), SOL_SOCKET, SO_RCVTIMEO,
- &tv, sizeof(tv));
- }
rlen = SSL_read(ssl, buf, len);
if (rlen < 0) {