Page MenuHomeFreeBSD

libfetch: Further improve connection polling
ClosedPublic

Authored by des on Tue, Jul 28, 9:16 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Aug 4, 12:56 PM
Unknown Object (File)
Tue, Aug 4, 6:26 AM
Unknown Object (File)
Tue, Aug 4, 4:38 AM
Unknown Object (File)
Tue, Aug 4, 3:34 AM
Unknown Object (File)
Mon, Aug 3, 9:03 AM
Unknown Object (File)
Mon, Aug 3, 5:23 AM
Unknown Object (File)
Mon, Aug 3, 1:41 AM
Unknown Object (File)
Mon, Aug 3, 12:26 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.Tue, Jul 28, 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.Tue, Jul 28, 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.Tue, Jul 28, 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.Tue, Jul 28, 2:07 PM
This revision is now accepted and ready to land.Tue, Jul 28, 2:12 PM
This revision was automatically updated to reflect the committed changes.