diff --git a/crates/extension_host/src/extension_host.rs b/crates/extension_host/src/extension_host.rs index 81edf705217754d92b9a73f96249d8642796b252..cd34521935362bc36d2a6b2b7f418f357f40c593 100644 --- a/crates/extension_host/src/extension_host.rs +++ b/crates/extension_host/src/extension_host.rs @@ -1682,12 +1682,15 @@ impl ExtensionStore { pub fn register_ssh_client(&mut self, client: Entity, cx: &mut Context) { let connection_options = client.read(cx).connection_options(); - if self.ssh_clients.contains_key(&connection_options.ssh_url()) { - return; + let ssh_url = connection_options.ssh_url(); + + if let Some(existing_client) = self.ssh_clients.get(&ssh_url) { + if existing_client.upgrade().is_some() { + return; + } } - self.ssh_clients - .insert(connection_options.ssh_url(), client.downgrade()); + self.ssh_clients.insert(ssh_url, client.downgrade()); self.ssh_registered_tx.unbounded_send(()).ok(); } }