Commit d7b2a63
rpc: use library Close helper for websocket disconnect (#20913)
## Summary
Follow-up to #20788. Address review feedback from @anacrolix:
> I thought there was a helper in the websocket library for this so you
don't need to spin up a bunch of timers and goroutines?
The `coder/websocket` `Conn.Close(code, reason)` method already performs
the close handshake with bounded internal timeouts (5s write, 5s read),
so the manual goroutine + timer plumbing in `wsConnAdapter.Close` is
redundant. Replace it with a direct call.
The existing `TestWebsocketServerGracefulClose` test still passes —
clients see a clean `StatusNormalClosure` (1000) instead of
`StatusAbnormalClosure` (1006).
## Test plan
- [x] `go test ./rpc/ -run Websocket` — all pass
- [x] `make lint` — clean
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: info@weblogix.biz <admin@10gbps.weblogix.it>1 parent cc38945 commit d7b2a63
1 file changed
Lines changed: 1 addition & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
| 260 | + | |
282 | 261 | | |
283 | 262 | | |
284 | 263 | | |
| |||
0 commit comments