diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2026-02-18 15:10:47 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2026-02-18 15:10:47 +0000 |
| commit | 73b82d1b0a2f09224e6d0f7a13dd73c66d740207 (patch) | |
| tree | a942b159315b27ddcbb66687447e72c7995b49d8 | |
| parent | f8517c21d57f1db005c0d15e14d16252e8e4bfd0 (diff) | |
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
| -rw-r--r-- | lib/libfetch/common.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index ec010909218b..75cb4320ad99 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) { |
