I've been doing some work that catches different connection errors and prompts the user for additional information. This works great except that the SSH client isn't assigned to the Connection object until after the connection. On error, the Connection object doesn't have a references to this.__ssh yet, meaning the close method does nothing to cancel out the current request.
This adjust the sftp method so that it assigns the ssh client to this.__ssh immediately and uses that as it's reference through the whole method. This has allowed me to properly clean up between connection attempts.
I've been doing some work that catches different connection errors and prompts the user for additional information. This works great except that the SSH client isn't assigned to the Connection object until after the connection. On error, the Connection object doesn't have a references to
this.__ssh
yet, meaning the close method does nothing to cancel out the current request.This adjust the sftp method so that it assigns the ssh client to
this.__ssh
immediately and uses that as it's reference through the whole method. This has allowed me to properly clean up between connection attempts.