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)
Sun, Aug 16, 12:45 AM
Unknown Object (File)
Tue, Aug 11, 8:48 AM
Unknown Object (File)
Tue, Aug 11, 5:46 AM
Unknown Object (File)
Mon, Aug 10, 5:29 PM
Unknown Object (File)
Sun, Aug 9, 1:51 AM
Unknown Object (File)
Fri, Aug 7, 7:11 PM
Unknown Object (File)
Fri, Aug 7, 5:52 PM
Unknown Object (File)
Fri, Aug 7, 1:37 PM
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 Not Applicable
Unit
Tests Not Applicable

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

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.