Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remoting: Fix opening multiple folders on one server (#20281)
Conrad Irwin846aec701f46
diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rsindex fdf40ecae3c..49d870f56bc 100644--- a/crates/recent_projects/src/remote_servers.rs+++ b/crates/recent_projects/src/remote_servers.rs@@ -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,diff --git a/crates/remote/src/ssh_session.rs b/crates/remote/src/ssh_session.rsindex ba19fa5c14e..f6466e99732 100644--- a/crates/remote/src/ssh_session.rs+++ b/crates/remote/src/ssh_session.rs@@ -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),