Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
alexr00 committed Nov 28, 2019
1 parent 9593c06 commit 8d5e4fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/vs/platform/remote/common/tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export interface ITunnelService {
_serviceBrand: undefined;

readonly tunnels: Promise<readonly RemoteTunnel[]>;
onTunnelOpened: Event<RemoteTunnel>;
onTunnelClosed: Event<number>;
readonly onTunnelOpened: Event<RemoteTunnel>;
readonly onTunnelClosed: Event<number>;

openTunnel(remotePort: number, localPort?: number): Promise<RemoteTunnel> | undefined;
closeTunnel(remotePort: number): Promise<void>;
Expand Down
17 changes: 4 additions & 13 deletions src/vs/workbench/services/remote/common/remoteExplorerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export interface Tunnel {
}

export class TunnelModel extends Disposable {
forwarded: Map<number, Tunnel>;
published: Map<number, Tunnel>;
candidates: Map<number, Tunnel>;
readonly forwarded: Map<number, Tunnel>;
readonly published: Map<number, Tunnel>;
readonly candidates: Map<number, Tunnel>;
private _onForwardPort: Emitter<Tunnel> = new Emitter();
public onForwardPort: Event<Tunnel> = this._onForwardPort.event;
private _onClosePort: Emitter<number> = new Emitter();
Expand Down Expand Up @@ -105,16 +105,7 @@ export class TunnelModel extends Disposable {
}

address(remote: number): URI | undefined {
let tunnel: Tunnel | undefined = undefined;
if (this.forwarded.has(remote)) {
tunnel = this.forwarded.get(remote)!;
} else if (this.published.has(remote)) {
tunnel = this.published.get(remote)!;
}
if (tunnel) {
return tunnel.localUri;
}
return undefined;
return (this.forwarded.get(remote) || this.published.get(remote))?.localUri;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/services/remote/node/tunnelService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ export class TunnelService implements ITunnelService {
async closeTunnel(remotePort: number): Promise<void> {
if (this._tunnels.has(remotePort)) {
const value = this._tunnels.get(remotePort)!;
value.refcount = 0;
(await value.value).dispose();
value.refcount = 0;
}
}

Expand Down

0 comments on commit 8d5e4fe

Please sign in to comment.