From 54cc2486ee4201d8c62bc9535610ff75f72b820d Mon Sep 17 00:00:00 2001 From: Jesper Johansson <21033162+jesperjohansson@users.noreply.github.com> Date: Mon, 30 Jan 2023 10:45:33 +0100 Subject: [PATCH] fix: Allow destroying socket while connecting (#169) --- src/Socket.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Socket.js b/src/Socket.js index 51ca3d6..4268015 100644 --- a/src/Socket.js +++ b/src/Socket.js @@ -305,7 +305,7 @@ export default class Socket extends EventEmitter { * Ensures that no more I/O activity happens on this socket. Destroys the stream and closes the connection. */ destroy() { - if (this._pending || this._destroyed) return this; + if (this._destroyed) return this; this._destroyed = true; this._clearTimeout(); Sockets.destroy(this._id);