mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-03 08:54:04 +00:00
ssh-remoting: Tidy up the code a bit after #18094 (#18102)
Some checks are pending
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 / (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
Some checks are pending
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 / (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: - N/A
This commit is contained in:
parent
15b4130fa5
commit
8103ac12bf
4 changed files with 9 additions and 8 deletions
|
@ -1622,7 +1622,7 @@ impl ProtoClient for Client {
|
|||
&self.handler_set
|
||||
}
|
||||
|
||||
fn goes_via_collab(&self) -> bool {
|
||||
fn is_via_collab(&self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -313,9 +313,10 @@ impl WorktreeStore {
|
|||
})
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn add(&mut self, worktree: &Model<Worktree>, cx: &mut ModelContext<Self>) {
|
||||
let worktree_id = worktree.read(cx).id();
|
||||
debug_assert!(!self.worktrees().any(|w| w.read(cx).id() == worktree_id));
|
||||
debug_assert!(self.worktrees().all(|w| w.read(cx).id() != worktree_id));
|
||||
|
||||
let push_strong_handle = self.retain_worktrees || worktree.read(cx).is_visible();
|
||||
let handle = if push_strong_handle {
|
||||
|
@ -487,7 +488,7 @@ impl WorktreeStore {
|
|||
};
|
||||
|
||||
// collab has bad concurrency guarantees, so we send requests in serial.
|
||||
let update_project = if downstream_client.goes_via_collab() {
|
||||
let update_project = if downstream_client.is_via_collab() {
|
||||
Some(downstream_client.request(update))
|
||||
} else {
|
||||
downstream_client.send(update).log_err();
|
||||
|
@ -508,7 +509,7 @@ impl WorktreeStore {
|
|||
move |update| {
|
||||
let client = client.clone();
|
||||
async move {
|
||||
if client.goes_via_collab() {
|
||||
if client.is_via_collab() {
|
||||
client.request(update).map(|result| result.is_ok()).await
|
||||
} else {
|
||||
client.send(update).is_ok()
|
||||
|
|
|
@ -471,7 +471,7 @@ impl ProtoClient for SshSession {
|
|||
&self.state
|
||||
}
|
||||
|
||||
fn goes_via_collab(&self) -> bool {
|
||||
fn is_via_collab(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ pub trait ProtoClient: Send + Sync {
|
|||
|
||||
fn message_handler_set(&self) -> &parking_lot::Mutex<ProtoMessageHandlerSet>;
|
||||
|
||||
fn goes_via_collab(&self) -> bool;
|
||||
fn is_via_collab(&self) -> bool;
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -141,8 +141,8 @@ impl AnyProtoClient {
|
|||
Self(client)
|
||||
}
|
||||
|
||||
pub fn goes_via_collab(&self) -> bool {
|
||||
self.0.goes_via_collab()
|
||||
pub fn is_via_collab(&self) -> bool {
|
||||
self.0.is_via_collab()
|
||||
}
|
||||
|
||||
pub fn request<T: RequestMessage>(
|
||||
|
|
Loading…
Reference in a new issue