Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/transport-tcp/src/socket-to-conn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ class TCPSocketMultiaddrConnection extends AbstractMultiaddrConnection {
}

sendReset (): void {
if (this.socket.writableEnded) {
// socket.end() starts the graceful shutdown path, which uses uv_shutdown().
// resetAndDestroy() calls uv_tcp_close_reset(), which cannot be mixed with
// uv_shutdown(), so use destroy() after writable end has started.
// https://docs.libuv.org/en/v1.x/stream.html#c.uv_shutdown
// https://docs.libuv.org/en/v1.x/tcp.html#c.uv_tcp_close_reset
this.socket.destroy()
return
}

this.socket.resetAndDestroy()
}

Expand Down
Loading