Close and reopen tunnel when protocol changes

This commit is contained in:
Alex Ross
2021-05-18 17:09:39 +02:00
parent 960af85cd9
commit f113243a51

View File

@@ -583,11 +583,12 @@ export class TunnelModel extends Disposable {
} else {
if (attributes?.label ?? name) {
existingTunnel.name = attributes?.label ?? name;
this._onForwardPort.fire();
}
if (attributes?.protocol) {
existingTunnel.localUri = this.makeLocalUri(existingTunnel.localAddress, attributes);
if (attributes?.protocol !== existingTunnel.localUri.scheme) {
await this.close(existingTunnel.remoteHost, existingTunnel.remotePort);
await this.forward({ host: existingTunnel.remoteHost, port: existingTunnel.remotePort }, local, name, source, elevateIfNeeded, isPublic, restore, attributes);
}
this._onForwardPort.fire();
return mapHasAddressLocalhostOrAllInterfaces(this.remoteTunnels, remote.host, remote.port);
}
}