Skip to content

Commit dbb9eb4

Browse files
committed
Make port auto forwarding more sequential
1 parent a8a7127 commit dbb9eb4

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/vs/workbench/contrib/remote/browser/remoteExplorer.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -544,33 +544,36 @@ class ProcAutomaticPortForwarding extends Disposable {
544544

545545
private async forwardCandidates(): Promise<RemoteTunnel[] | undefined> {
546546
const attributes = await this.remoteExplorerService.tunnelModel.getAttributes(this.remoteExplorerService.tunnelModel.candidates.map(candidate => candidate.port));
547-
const allTunnels = <RemoteTunnel[]>(await Promise.all(this.remoteExplorerService.tunnelModel.candidates.map(async (value) => {
547+
const allTunnels: RemoteTunnel[] = [];
548+
for (const value of this.remoteExplorerService.tunnelModel.candidates) {
548549
if (!value.detail) {
549-
return undefined;
550+
continue;
550551
}
551552

552553
const address = makeAddress(value.host, value.port);
553554
if (this.initialCandidates.has(address)) {
554-
return undefined;
555+
continue;
555556
}
556557
if (this.notifiedOnly.has(address) || this.autoForwarded.has(address)) {
557-
return undefined;
558+
continue;
558559
}
559560
const alreadyForwarded = mapHasAddressLocalhostOrAllInterfaces(this.remoteExplorerService.tunnelModel.forwarded, value.host, value.port);
560561
if (mapHasAddressLocalhostOrAllInterfaces(this.remoteExplorerService.tunnelModel.detected, value.host, value.port)) {
561-
return undefined;
562+
continue;
562563
}
563564
if (attributes?.get(value.port)?.onAutoForward === OnPortForward.Ignore) {
564-
return undefined;
565+
continue;
565566
}
566567
const forwarded = await this.remoteExplorerService.forward(value, undefined, undefined, undefined, undefined, undefined, false);
567568
if (!alreadyForwarded && forwarded) {
568569
this.autoForwarded.add(address);
569570
} else if (forwarded) {
570571
this.notifiedOnly.add(address);
571572
}
572-
return forwarded;
573-
}))).filter(tunnel => !!tunnel);
573+
if (forwarded) {
574+
allTunnels.push(forwarded);
575+
}
576+
}
574577
if (allTunnels.length === 0) {
575578
return undefined;
576579
}

0 commit comments

Comments
 (0)