Remoting: Fix opening multiple folders on one server (#20281)
Some checks are pending
CI / Check Postgres and Protobuf migrations, mergability (push) Waiting to run
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Linux) Build Remote Server (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run

Release Notes:

- Remoting: Fix opening multiple folders on one server
This commit is contained in:
Conrad Irwin 2024-11-05 22:16:38 -07:00 committed by GitHub
parent cfce6a8fbf
commit 846aec701f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View file

@ -386,7 +386,7 @@ impl RemoteServerProjects {
let ssh_prompt = cx.new_view(|cx| SshPrompt::new(&connection_options, cx));
let connection = connect_over_ssh(
ConnectionIdentifier::Setup,
ConnectionIdentifier::setup(),
connection_options.clone(),
ssh_prompt.clone(),
cx,
@ -477,7 +477,7 @@ impl RemoteServerProjects {
.clone();
let connect = connect_over_ssh(
ConnectionIdentifier::Setup,
ConnectionIdentifier::setup(),
connection_options.clone(),
prompt,
cx,

View file

@ -40,7 +40,7 @@ use std::{
ops::ControlFlow,
path::{Path, PathBuf},
sync::{
atomic::{AtomicU32, Ordering::SeqCst},
atomic::{AtomicU32, AtomicU64, Ordering::SeqCst},
Arc, Weak,
},
time::{Duration, Instant},
@ -484,11 +484,16 @@ impl EventEmitter<SshRemoteEvent> for SshRemoteClient {}
// Identifies the socket on the remote server so that reconnects
// can re-join the same project.
pub enum ConnectionIdentifier {
Setup,
Setup(u64),
Workspace(i64),
}
static NEXT_ID: AtomicU64 = AtomicU64::new(1);
impl ConnectionIdentifier {
pub fn setup() -> Self {
Self::Setup(NEXT_ID.fetch_add(1, SeqCst))
}
// This string gets used in a socket name, and so must be relatively short.
// The total length of:
// /home/{username}/.local/share/zed/server_state/{name}/stdout.sock
@ -501,7 +506,7 @@ impl ConnectionIdentifier {
release_channel => format!("{}-", release_channel.dev_name()),
};
match self {
Self::Setup => format!("{identifier_prefix}setup"),
Self::Setup(setup_id) => format!("{identifier_prefix}setup-{setup_id}"),
Self::Workspace(workspace_id) => {
format!("{identifier_prefix}workspace-{workspace_id}",)
}
@ -1079,7 +1084,7 @@ impl SshRemoteClient {
client_cx
.update(|cx| {
Self::new(
ConnectionIdentifier::Setup,
ConnectionIdentifier::setup(),
opts,
rx,
Arc::new(fake::Delegate),