Skip to content

Commit

Permalink
SSH Remoting: Fix reconnects (#19485)
Browse files Browse the repository at this point in the history
Before this change messages could be lost on reconnect, now they will
not be.

Release Notes:

- SSH Remoting: make reconnects smoother

---------

Co-authored-by: Nathan <[email protected]>
  • Loading branch information
ConradIrwin and nathansobo authored Oct 20, 2024
1 parent 1ae30f5 commit 92c29be
Show file tree
Hide file tree
Showing 10 changed files with 467 additions and 199 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async fn test_sharing_an_ssh_remote_project(
.await;

// Set up project on remote FS
let (client_ssh, server_ssh) = SshRemoteClient::fake(cx_a, server_cx);
let (port, server_ssh) = SshRemoteClient::fake_server(cx_a, server_cx);
let remote_fs = FakeFs::new(server_cx.executor());
remote_fs
.insert_tree(
Expand Down Expand Up @@ -67,6 +67,7 @@ async fn test_sharing_an_ssh_remote_project(
)
});

let client_ssh = SshRemoteClient::fake_client(port, cx_a).await;
let (project_a, worktree_id) = client_a
.build_ssh_project("/code/project1", client_ssh, cx_a)
.await;
Expand Down
4 changes: 4 additions & 0 deletions crates/project/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,10 @@ impl Project {
self.client.clone()
}

pub fn ssh_client(&self) -> Option<Model<SshRemoteClient>> {
self.ssh_client.clone()
}

pub fn user_store(&self) -> Model<UserStore> {
self.user_store.clone()
}
Expand Down
8 changes: 7 additions & 1 deletion crates/proto/proto/zed.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ message Envelope {
uint32 id = 1;
optional uint32 responding_to = 2;
optional PeerId original_sender_id = 3;
optional uint32 ack_id = 266;

oneof payload {
Hello hello = 4;
Expand Down Expand Up @@ -295,7 +296,9 @@ message Envelope {
OpenServerSettings open_server_settings = 263;

GetPermalinkToLine get_permalink_to_line = 264;
GetPermalinkToLineResponse get_permalink_to_line_response = 265; // current max
GetPermalinkToLineResponse get_permalink_to_line_response = 265;

FlushBufferedMessages flush_buffered_messages = 267;
}

reserved 87 to 88;
Expand Down Expand Up @@ -2522,3 +2525,6 @@ message GetPermalinkToLine {
message GetPermalinkToLineResponse {
string permalink = 1;
}

message FlushBufferedMessages {}
message FlushBufferedMessagesResponse {}
1 change: 1 addition & 0 deletions crates/proto/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ macro_rules! messages {
responding_to,
original_sender_id,
payload: Some(envelope::Payload::$name(self)),
ack_id: None,
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/proto/src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ messages!(
(OpenServerSettings, Foreground),
(GetPermalinkToLine, Foreground),
(GetPermalinkToLineResponse, Foreground),
(FlushBufferedMessages, Foreground),
);

request_messages!(
Expand Down Expand Up @@ -498,6 +499,7 @@ request_messages!(
(RemoveWorktree, Ack),
(OpenServerSettings, OpenBufferResponse),
(GetPermalinkToLine, GetPermalinkToLineResponse),
(FlushBufferedMessages, Ack),
);

entity_messages!(
Expand Down
1 change: 1 addition & 0 deletions crates/remote/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test-support = ["fs/test-support"]

[dependencies]
anyhow.workspace = true
async-trait.workspace = true
collections.workspace = true
fs.workspace = true
futures.workspace = true
Expand Down
Loading

0 comments on commit 92c29be

Please sign in to comment.