From 1087e4b16d0a2cf304f68566c3eec63b5bf2372d Mon Sep 17 00:00:00 2001 From: Martijn Imhoff Date: Tue, 27 Feb 2024 21:58:03 +0100 Subject: [PATCH] Destroy socket on client close (#250) * Destroy socket on client close * Only use destroy, not end and destroy both * Update npm install process --- .gitignore | 3 ++- package.json | 1 + src/FtpContext.ts | 4 +--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 892d067..2e1d5d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules temp dist -.vscode \ No newline at end of file +.vscode +.idea \ No newline at end of file diff --git a/package.json b/package.json index 92474bb..015328a 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ ], "scripts": { "prepublishOnly": "npm run clean && npm run lint && tsc && mocha", + "prepare": "tsc", "test": "npm run prepublishOnly", "clean": "rm -rf dist", "lint": "eslint \"./src/**/*.ts\"", diff --git a/src/FtpContext.ts b/src/FtpContext.ts index 70f0e79..0b073a2 100644 --- a/src/FtpContext.ts +++ b/src/FtpContext.ts @@ -392,9 +392,7 @@ export class FTPContext { if (socket) { this._removeSocketListeners(socket) socket.on("error", doNothing) - socket.on("timeout", () => socket.destroy()) - socket.setTimeout(this.timeout) - socket.end() + socket.destroy() } }