* fix: Unhandled socket error during websocket upgrade crashes server
Node removes its own socket error handling before emitting the "upgrade"
event, so any socket detached from the HTTP server without a listener of
its own will terminate the process when the client goes away.
Handle errors for every upgraded socket in one place, and destroy sockets
we reject rather than leaving them half-open to be reset at any point in
the future.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Flush rejection response before destroying the socket
Destroying immediately after the write can truncate the response if the
socket's write buffer has not drained, leaving the client with a reset in
place of the rejection.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* noisy comment
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>