debugger: Fix wrong port used for SSH debugging (#31474)

We were trying to connect on the user's machine to the port number used
by the debugger on the remote machine, instead of the randomly-assigned
local available port.

Release Notes:

- Debugger Beta: Fixed a bug that caused connecting to a debug adapter
over SSH to hang.
This commit is contained in:
Cole Miller 2025-05-26 21:18:10 -04:00 committed by GitHub
parent 5e72c2a870
commit 62545b985f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -240,13 +240,13 @@ impl DapStore {
let mut connection = None;
if let Some(c) = binary.connection {
let local_bind_addr = Ipv4Addr::new(127, 0, 0, 1);
let local_bind_addr = Ipv4Addr::LOCALHOST;
let port =
dap::transport::TcpTransport::unused_port(local_bind_addr).await?;
ssh_command.add_port_forwarding(port, c.host.to_string(), c.port);
connection = Some(TcpArguments {
port: c.port,
port,
host: local_bind_addr,
timeout: c.timeout,
})