patrickjuchli / basic-ftp

FTP client for Node.js, supports FTPS over TLS, passive mode over IPv6, async/await, and Typescript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Send response on closewitherror on FTContext

danydasilva opened this issue · comments

Send response before close the socket, this cause error for me when the timeout is ocurred twice.

closeWithError(err: Error) {
// If this context already has been closed, don't overwrite the reason.
if (this._closingError) {
return
}
this._closingError = err
// Close the sockets but don't fully reset this context to preserve this._closingError.
this._closeSocket(this._socket)
this._closeSocket(this._dataSocket)
// Give the user's task a chance to react, maybe cleanup resources.
this._passToHandler(err)
// The task might not have been rejected by the user after receiving the error.
this._stopTrackingTask()
this.send("QUIT") // Don't wait for an answer
}

Addressed in 5.0.3