You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering an issue which seems to be related to ISSUE-429, where the problem still persists. As im not aware of any pitfalls in the code, i have created a suggestion to resolve the issue.
Description:
The problem is caused by the assignment of the this.connection property before the connection promise resolves. Specifically, the this.connection property is being set before the connection.on('ready') event is triggered.
Proposed Solution:
To resolve this issue, I suggest moving the assignment of this.connection inside the connection.on('ready') event in the connect method:
publicasyncconnect(givenConfig: Config): Promise<this>{// ... (Rest of the code remains the same)const connection =newSSH2.Client();awaitnewPromise<void>((resolve,reject)=>{connection.on('error',reject);if(config.onKeyboardInteractive){connection.on('keyboard-interactive',config.onKeyboardInteractive);}connection.on('ready',()=>{connection.removeListener('error',reject);this.connection=connection;// Move this line inside the 'ready' eventresolve();});connection.on('end',()=>{if(this.connection===connection){this.connection=null;}});connection.on('close',()=>{if(this.connection===connection){this.connection=null;}reject(newSSHError('No response from server','ETIMEDOUT'));});connection.connect(config);});returnthis;}
Will i help?
Yeah, let us discuss and i can create a PR :)
The text was updated successfully, but these errors were encountered:
I am encountering an issue which seems to be related to ISSUE-429, where the problem still persists. As im not aware of any pitfalls in the code, i have created a suggestion to resolve the issue.
Description:
The problem is caused by the assignment of the this.connection property before the connection promise resolves. Specifically, the this.connection property is being set before the connection.on('ready') event is triggered.
Proposed Solution:
To resolve this issue, I suggest moving the assignment of this.connection inside the connection.on('ready') event in the connect method:
Will i help?
Yeah, let us discuss and i can create a PR :)
The text was updated successfully, but these errors were encountered: