Page MenuHomeFreeBSD

libfetch: Further improve connection polling
ClosedPublic

Authored by des on Jul 28 2026, 9:16 AM.
Tags
None
Referenced Files
F168935284: D58512.id182955.diff
Sun, Aug 30, 8:21 PM
F168850305: D58512.diff
Sun, Aug 30, 11:01 AM
F168751322: D58512.diff
Sat, Aug 29, 11:25 PM
Unknown Object (File)
Sat, Aug 29, 2:02 PM
Unknown Object (File)
Sat, Aug 29, 1:47 PM
Unknown Object (File)
Sat, Aug 29, 7:10 AM
Unknown Object (File)
Sat, Aug 29, 4:54 AM
Unknown Object (File)
Sat, Aug 29, 4:52 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 75233
Build 72116: 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–695

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–695

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.