Page MenuHomeFreeBSD

libfetch: Further improve connection polling
ClosedPublic

Authored by des on Jul 28 2026, 9:16 AM.
Tags
None
Referenced Files
F170697328: D58512.id182924.diff
Sun, Sep 6, 2:08 AM
F170647740: D58512.diff
Sat, Sep 5, 7:30 PM
Unknown Object (File)
Sat, Sep 5, 3:00 PM
Unknown Object (File)
Sat, Sep 5, 10:11 AM
Unknown Object (File)
Sat, Sep 5, 5:26 AM
Unknown Object (File)
Sat, Sep 5, 5:05 AM
Unknown Object (File)
Sat, Sep 5, 4:09 AM
Unknown Object (File)
Fri, Sep 4, 5:58 AM
Subscribers

Details

Summary
  • Reorganize the connection loop to make it a little more readable
  • Start the timeout clock earlier
  • Correctly calculate the poll timeout before calling poll()
  • Don't leak the socket on failure

Fixes: 848f360c8f9a ("libfetch: Apply timeout to connection attempts")
Fixes: b02e02958dad ("libfetch: Fix handling of connection failures")
MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 75230
Build 72113: arc lint + arc unit

Event Timeline

des requested review of this revision.Jul 28 2026, 9:16 AM
lib/libfetch/common.c
652

Probably we need to preserve errno around this too?

686

Do you need to test err == 0 first?

731

The socket is cleaned up here, how is it leaked?

des marked 2 inline comments as done.Jul 28 2026, 2:00 PM
des added inline comments.
lib/libfetch/common.c
652

No, fetch_verbose() is a wrapper around fetch_info() which saves and restores errno.

686

yes

des marked 2 inline comments as done.

rf

des marked an inline comment as done.Jul 28 2026, 2:04 PM
des added inline comments.
lib/libfetch/common.c
731

If there were multiple addresses we'd leak all but the last socket.

des marked an inline comment as done.Jul 28 2026, 2:07 PM
This revision is now accepted and ready to land.Jul 28 2026, 2:12 PM
This revision was automatically updated to reflect the committed changes.