652
throw new Error(`SSH relay creation timed out after ${timeoutMs}ms (SSH client appears unresponsive)`);
653
}
655
>
conn = new SSHConnection(
656
>
config, connectionId, connectionKey, config.name,
657
>
connectionToken, remotePort, sshClient, relay, undefined,
658
>
this._logService,
659
>
);
660
>
661
>
Event.once(conn.onDidClose)(() => {
662
>
if (this._connections.get(connectionKey) === conn) {
663
>
this._connections.deleteAndDispose(connectionKey);
664
>
this._onDidRelayClose.fire(connectionId);
665
>
this._onDidCloseConnection.fire(connectionId);
666
>
this._onDidChangeConnections.fire();
667
>
}
668
>
});
669
>
670
>
this._connections.set(connectionKey, conn);
671
>
672
>
return {
673
>
connectionId: conn.connectionId,
674
>
address: conn.address,
675
>
name: conn.name,
676
>
connectionToken: conn.connectionToken,
677
>
config: conn.config,
678
>
sshConfigHost: config.sshConfigHost,
679
>
};
680
} catch (err) {
681
sshClient.end();