Fix problems with changing local port and restoring

Fixes #92008
This commit is contained in:
Alex Ross
2020-03-04 16:45:23 +01:00
parent 361a5447eb
commit 426d5bfb94
11 changed files with 49 additions and 28 deletions

View File

@@ -23,8 +23,8 @@ class ExtensionTunnel implements vscode.Tunnel {
onDidDispose: Event<void> = this._onDispose.event;
constructor(
public readonly remoteAddress: { port: number; host: string; },
public readonly localAddress: string,
public readonly remoteAddress: { port: number, host: string },
public readonly localAddress: { port: number, host: string } | string,
private readonly _dispose: () => void) { }
dispose(): void {
@@ -52,6 +52,7 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
this.registerCandidateFinder();
}
}
async openTunnel(forward: TunnelOptions): Promise<vscode.Tunnel | undefined> {
const tunnel = await this._proxy.$openTunnel(forward);
if (tunnel) {
@@ -91,6 +92,7 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
} else {
this._forwardPortProvider = undefined;
}
await this._proxy.$tunnelServiceReady();
return toDisposable(() => {
this._forwardPortProvider = undefined;
});