mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 11:38:51 +01:00
Try restoring ports more often
Part of microsoft/vscode-remote-release#4551
This commit is contained in:
@@ -327,6 +327,7 @@ export class TunnelModel extends Disposable {
|
||||
public onEnvironmentTunnelsSet: Event<void> = this._onEnvironmentTunnelsSet.event;
|
||||
private _environmentTunnelsSet: boolean = false;
|
||||
private configPortsAttributes: PortsAttributes;
|
||||
private restoreListener: IDisposable | undefined;
|
||||
|
||||
private portAttributesProviders: PortAttributesProvider[] = [];
|
||||
|
||||
@@ -429,18 +430,19 @@ export class TunnelModel extends Disposable {
|
||||
await this.forward({ host: tunnel.remoteHost, port: tunnel.remotePort }, tunnel.localPort, tunnel.name, undefined, undefined, tunnel.privacy === TunnelPrivacy.Public);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// It's possible that at restore time the value hasn't synced.
|
||||
const key = await this.getStorageKey();
|
||||
const listener = this.storageService.onDidChangeValue(async (e) => {
|
||||
if (e.key === key) {
|
||||
listener.dispose();
|
||||
this.tunnelRestoreValue = Promise.resolve(this.storageService.get(await this.getStorageKey(), StorageScope.GLOBAL));
|
||||
await this.restoreForwarded();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.restoreListener) {
|
||||
// It's possible that at restore time the value hasn't synced.
|
||||
const key = await this.getStorageKey();
|
||||
this.restoreListener = this._register(this.storageService.onDidChangeValue(async (e) => {
|
||||
if (e.key === key) {
|
||||
this.tunnelRestoreValue = Promise.resolve(this.storageService.get(await this.getStorageKey(), StorageScope.GLOBAL));
|
||||
await this.restoreForwarded();
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private async storeForwarded() {
|
||||
|
||||
Reference in New Issue
Block a user