We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, i had the problem that calling closeTunnel(..) would hang until all sockets were closed. Maybe closeTunnel should itself close the connections?
This could be done like this, when the connections are established we keep track of the sockets: (in file sshConnection.ts)
server = net.createServer().on("connection", (socket) => { this.activeTunnels[tunnelConfig.name].sockets.push(socket); this.connect().then(() => {...
And the closeTunnel method could look like this (the close sockets part is new):
closeTunnel(name?: string): Promise<void> { if (name && this.activeTunnels[name]) { return new Promise((resolve, reject) => { var tunnel = this.activeTunnels[name]; this.emit(SSHConstants.CHANNEL.TUNNEL, SSHConstants.STATUS.BEFOREDISCONNECT, { tunnelConfig: tunnel }); // subscribe to close event tunnel.server.close((err) => { this.emit(SSHConstants.CHANNEL.TUNNEL, SSHConstants.STATUS.DISCONNECT, { tunnelConfig: this.activeTunnels[name], }); delete this.activeTunnels[name]; if (err) { reject(err); } else { resolve(); } }); // close sockets if(tunnel.sockets) { for(let socket of tunnel.sockets) { socket.destroySoon(); } } }); } else if (!name) { var tunnels = Object.keys(this.activeTunnels).map((key) => this.closeTunnel(key)); return Promise.all(tunnels).then(() => {}); } } }
what do you think?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello, i had the problem that calling closeTunnel(..) would hang until all sockets were closed.
Maybe closeTunnel should itself close the connections?
This could be done like this, when the connections are established we keep track of the sockets: (in file sshConnection.ts)
And the closeTunnel method could look like this (the close sockets part is new):
what do you think?
The text was updated successfully, but these errors were encountered: