Skip to content

Commit 2f2b152

Browse files
zkx5xktsomeone
and
someone
authored
fix: DebugSessionTunnels. Misplaced remote/local port usage (#1163)
Co-authored-by: someone <[email protected]>
1 parent b655939 commit 2f2b152

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/ui/companionBrowserLaunch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ const launchCompanionBrowser = async (
6868
tunnelRemoteServerIfNecessary(args),
6969
sessionTunnels
7070
.request(session.id, {
71-
localPort: args.serverPort,
71+
remotePort: args.serverPort,
7272
label: 'Browser Debug Tunnel',
7373
})
7474
.catch(() => undefined),
7575
]);
7676

7777
await vscode.commands.executeCommand('js-debug-companion.launchAndAttach', {
78-
proxyUri: tunnel ? `127.0.0.1:${tunnel.remoteAddress.port}` : `127.0.0.1:${args.serverPort}`,
78+
proxyUri: tunnel ? `127.0.0.1:${tunnel.localAddress.port}` : `127.0.0.1:${args.serverPort}`,
7979
...args,
8080
});
8181
} catch (e) {

src/ui/debugSessionTunnels.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ export class DebugSessionTunnels implements IDisposable {
4545
sessionId: string,
4646
opts: {
4747
label: string;
48-
localPort: number;
49-
remotePort?: number;
48+
localPort?: number;
49+
remotePort: number;
5050
},
5151
) {
5252
let tunnel = this.tunnels.get(sessionId);
5353
if (!tunnel) {
5454
tunnel = await vscode.workspace.openTunnel({
55-
remoteAddress: { port: opts.remotePort ?? opts.localPort, host: 'localhost' },
56-
localAddressPort: opts.localPort,
55+
remoteAddress: { port: opts.remotePort, host: 'localhost' },
56+
localAddressPort: opts.localPort ?? opts.remotePort,
5757
label: opts.label,
5858
});
5959
}

src/ui/requestCDPProxy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ export const registerRequestCDPProxy = (
3030
try {
3131
const tunneled = await tunnels.request(sessionId, {
3232
label: 'Edge Devtools Tunnel',
33-
localPort: proxied.port,
33+
remotePort: proxied.port,
3434
});
3535

3636
return {
37-
host: tunneled.remoteAddress.host,
38-
port: tunneled.remoteAddress.port,
37+
host: tunneled.localAddress.host,
38+
port: tunneled.localAddress.port,
3939
path: proxied.path,
4040
};
4141
} catch {

0 commit comments

Comments
 (0)