- 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