basic-ftp
Advanced tools
Comparing version 2.16.0 to 2.16.1
# Changelog | ||
## 2.16.1 | ||
- Fixed: Closing client during task will reject associated promise. (#34) | ||
## 2.16.0 | ||
@@ -4,0 +8,0 @@ |
@@ -89,12 +89,7 @@ "use strict"; | ||
/** | ||
* Close control and data connections. | ||
* Close the context by resetting its state. | ||
*/ | ||
close() { | ||
this.log("Closing connections."); | ||
this._stopTrackingTask(); | ||
this._partialResponse = ""; | ||
this._closeSocket(this._socket); | ||
this._closeSocket(this._dataSocket); | ||
// Set a new socket instance to make reconnecting possible. | ||
this.socket = new Socket(); | ||
this._passToHandler({ error: { info: "User closed client during task." }}); | ||
this._reset(); | ||
} | ||
@@ -278,2 +273,17 @@ | ||
/** | ||
* Reset the state of this context. | ||
* | ||
* @private | ||
*/ | ||
_reset() { | ||
this.log("Closing connections."); | ||
this._stopTrackingTask(); | ||
this._partialResponse = ""; | ||
this._closeSocket(this._socket); | ||
this._closeSocket(this._dataSocket); | ||
// Set a new socket instance to make reconnecting possible. | ||
this.socket = new Socket(); | ||
} | ||
/** | ||
* Send an error to the current handler and close all connections. | ||
@@ -285,6 +295,5 @@ * | ||
_closeWithError(error) { | ||
this.log("Will close connections because of error:"); | ||
this.log(error); | ||
this._passToHandler({ error }); | ||
this.close(); | ||
this._reset(); | ||
} | ||
@@ -291,0 +300,0 @@ |
{ | ||
"name": "basic-ftp", | ||
"version": "2.16.0", | ||
"version": "2.16.1", | ||
"description": "FTP client for Node.js with support for explicit FTPS over TLS.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/ftp", |
@@ -20,2 +20,3 @@ const assert = require("assert"); | ||
afterEach(function() { | ||
client.ftp._reset(); | ||
client.close(); | ||
@@ -22,0 +23,0 @@ }); |
113660
2478