websocket: make the output dial honour its context - #484
Conversation
|
Commits LGTM Review Small, well-scoped fix: Checked and found clean: the context-error path in LGTM |
The output dial takes a context and discards it. A peer that accepts TCP and then stays silent keeps Connect blocked until the dialer handshake timeout of 45s, which blocks a graceful shutdown for that whole time. Replace the dial with dialContext, which the input already uses. The tls and non-tls paths now differ only by the dialer field they set, so the duplicated dial call goes away. Connect and ConnectionTest both pass a real context, and the async writer gives Connect a soft stop context. A dial to a silent peer now ends with the context error instead of running to the handshake timeout. Add a test mirroring the input test, using the shared listener helpers so it only adds the writer constructors.
152df18 to
eb9ed68
Compare
|
Commits Review LGTM |
The output dial takes a context and discards it. A peer that accepts TCP and then stays silent keeps Connect blocked until the dialer handshake timeout of 45s, which blocks a graceful shutdown for that whole time.
Replace the dial with dialContext, which the input already uses. The tls and non-tls paths now differ only by the dialer field they set, so the duplicated dial call goes away.
Connect and ConnectionTest both pass a real context, and the async writer gives Connect a soft stop context. A dial to a silent peer now ends with the context error instead of running to the handshake timeout.
Add a test mirroring the input test, using the shared listener helpers so it only adds the writer constructors.
Refs: