提交 065f0e46 编写于 作者: A Alex Ross

Auto forwarding fix

上级 7a9bb5a4
......@@ -27,7 +27,11 @@ export class MainThreadTunnelService extends Disposable implements MainThreadTun
}
async $setCandidateFinder(): Promise<void> {
this._register(this.remoteExplorerService.onEnabledPortsFeatures(() => this._proxy.$registerCandidateFinder()));
if (this.remoteExplorerService.portsFeaturesEnabled) {
this._proxy.$registerCandidateFinder();
} else {
this._register(this.remoteExplorerService.onEnabledPortsFeatures(() => this._proxy.$registerCandidateFinder()));
}
}
async $openTunnel(tunnelOptions: TunnelOptions, source: string): Promise<TunnelDto | undefined> {
......
......@@ -305,11 +305,12 @@ export class TunnelModel extends Disposable {
async restoreForwarded() {
if (this.configurationService.getValue('remote.restoreForwardedPorts')) {
if (this.tunnelRestoreValue) {
(<Tunnel[] | undefined>JSON.parse(this.tunnelRestoreValue))?.forEach(tunnel => {
const tunnels = <Tunnel[] | undefined>JSON.parse(this.tunnelRestoreValue) ?? [];
for (let tunnel of tunnels) {
if (!mapHasAddressLocalhostOrAllInterfaces(this.detected, tunnel.remoteHost, tunnel.remotePort)) {
this.forward({ host: tunnel.remoteHost, port: tunnel.remotePort }, tunnel.localPort, tunnel.name, undefined, undefined, tunnel.privacy === TunnelPrivacy.Public);
await this.forward({ host: tunnel.remoteHost, port: tunnel.remotePort }, tunnel.localPort, tunnel.name, undefined, undefined, tunnel.privacy === TunnelPrivacy.Public);
}
});
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册