Skip to content

Commit

Permalink
fix: error during close connection
Browse files Browse the repository at this point in the history
  • Loading branch information
maitrungduc1410 committed Nov 19, 2022
1 parent b0705f7 commit cd1d4dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.22](https://github.com/maitrungduc1410/node-scp-async/compare/v0.0.21...v0.0.22) (2022-09-20)


### Fixes

* error during close connection

### [0.0.21](https://github.com/maitrungduc1410/node-scp-async/compare/v0.0.20...v0.0.21) (2022-09-20)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "node-scp",
"title": "SCP module for NodeJS",
"description": "Lightweight, fast and secure SCP function for NodeJS",
"version": "0.0.21",
"version": "0.0.22",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"license": "MIT",
Expand Down
11 changes: 2 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,17 +462,10 @@ export class ScpClient extends EventEmitter {
* Close SSH connection
*/
public close() {
if (this.sftpWrapper) {
this.sftpWrapper.close(Buffer.alloc(1), (err => {
if (err) {
console.log('Error during closing sftpWrapper', err)
}
}))
this.sftpWrapper = null
}
if (this.sshClient) {
if (this.sshClient && this.sftpWrapper) {
this.sshClient.end()
this.sshClient = null
this.sftpWrapper = null
}

this.endCalled = true
Expand Down

0 comments on commit cd1d4dc

Please sign in to comment.