mirror of
https://github.com/safing/portmaster.git
synced 2026-12-04 09:38:21 +00:00
cc164c7df6
After the TCP connect, launchHTTPShip wrote the upgrade request and read the response without a deadline, ignoring ctx. With keep-alive disabled, a peer that accepts the connection but never answers blocked the caller forever. After a sleep/resume cycle this left the SPN client stuck in establishHomeHub: the 5 minute timeout in connectToHomeHub had no effect, and the UI kept showing "Connecting to SPN..." until a restart. Bound the handshake by a deadline of 30s, or the ctx deadline if that is earlier, and close the connection when ctx is done. Both are lifted once the handshake succeeds, so the ship's connection is unaffected. Also close the connection on all handshake error paths, which previously leaked it. The new test covers a peer that accepts but never responds, for both a ctx deadline and a ctx cancel.