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
discovered that the cause was the order of function calls.
The addListServer is called first, which sets the close event on the server.
This defines the process of closing the sshConnection when the server terminates.
*See below.
function addListenerServer(server) {
if (tunnelOptionsLocal.reconnectOnError) {
server.on('error', async () => {
server = await createServer(serverOptions);
addListenerServer(server);
});
}
server.on('connection', onConnectionHandler);
server.on('close', () => sshConnection.end()); //The line that causes
}
After that, addListerSshConnection is called.
However, if the ssh connection fails here, the SSH connection failure is first returned as a reject.
Then the Server's Close event is executed and an error occurs as it tries to close the non-existent sshConnection.
However, since it has already returned a Reject, it is not properly handled and the application seems to crash.
Therefore, I believe that creating the SSH tunnel first and then the ServerListener will solve this problem.
I implemented the following.
Passing incorrect SSH credentials to this code results in the following output and application termination.
The following can be gleaned from the above output
What should I do to resolve this situation (application terminated)?
The text was updated successfully, but these errors were encountered: