@@ -1,9 +1,8 @@
use crate::{
dev_container::start_dev_container,
remote_connections::{
- Connection, RemoteConnectionModal, RemoteConnectionPrompt, SshConnection,
- SshConnectionHeader, SshSettings, connect, determine_paths_with_positions,
- open_remote_project,
+ Connection, RemoteConnectionModal, RemoteConnectionPrompt, RemoteSettings, SshConnection,
+ SshConnectionHeader, connect, determine_paths_with_positions, open_remote_project,
},
ssh_config::parse_ssh_config_hosts,
};
@@ -188,7 +187,7 @@ impl EditNicknameState {
index,
editor: cx.new(|cx| Editor::single_line(window, cx)),
};
- let starting_text = SshSettings::get_global(cx)
+ let starting_text = RemoteSettings::get_global(cx)
.ssh_connections()
.nth(index.0)
.and_then(|state| state.nickname)
@@ -493,7 +492,7 @@ impl DefaultState {
let add_new_devcontainer = NavigableEntry::new(&handle, cx);
let add_new_wsl = NavigableEntry::new(&handle, cx);
- let ssh_settings = SshSettings::get_global(cx);
+ let ssh_settings = RemoteSettings::get_global(cx);
let read_ssh_config = ssh_settings.read_ssh_config;
let ssh_servers = ssh_settings
@@ -687,7 +686,7 @@ impl RemoteServerProjects {
cx: &mut Context<Self>,
) -> Self {
let focus_handle = cx.focus_handle();
- let mut read_ssh_config = SshSettings::get_global(cx).read_ssh_config;
+ let mut read_ssh_config = RemoteSettings::get_global(cx).read_ssh_config;
let ssh_config_updates = if read_ssh_config {
spawn_ssh_config_watch(fs.clone(), cx)
} else {
@@ -702,7 +701,7 @@ impl RemoteServerProjects {
let _subscription =
cx.observe_global_in::<SettingsStore>(window, move |recent_projects, _, cx| {
- let new_read_ssh_config = SshSettings::get_global(cx).read_ssh_config;
+ let new_read_ssh_config = RemoteSettings::get_global(cx).read_ssh_config;
if read_ssh_config != new_read_ssh_config {
read_ssh_config = new_read_ssh_config;
if read_ssh_config {
@@ -2328,7 +2327,7 @@ impl RemoteServerProjects {
window: &mut Window,
cx: &mut Context<Self>,
) -> impl IntoElement {
- let Some(connection) = SshSettings::get_global(cx)
+ let Some(connection) = RemoteSettings::get_global(cx)
.ssh_connections()
.nth(state.index.0)
else {
@@ -2368,7 +2367,7 @@ impl RemoteServerProjects {
window: &mut Window,
cx: &mut Context<Self>,
) -> impl IntoElement {
- let ssh_settings = SshSettings::get_global(cx);
+ let ssh_settings = RemoteSettings::get_global(cx);
let mut should_rebuild = false;
let ssh_connections_changed = ssh_settings.ssh_connections.0.iter().ne(state
@@ -154,7 +154,7 @@ enum State {
HeartbeatMissed {
missed_heartbeats: usize,
- ssh_connection: Arc<dyn RemoteConnection>,
+ remote_connection: Arc<dyn RemoteConnection>,
delegate: Arc<dyn RemoteClientDelegate>,
multiplex_task: Task<Result<()>>,
@@ -162,7 +162,7 @@ enum State {
},
Reconnecting,
ReconnectFailed {
- ssh_connection: Arc<dyn RemoteConnection>,
+ remote_connection: Arc<dyn RemoteConnection>,
delegate: Arc<dyn RemoteClientDelegate>,
error: anyhow::Error,
@@ -190,11 +190,14 @@ impl State {
fn remote_connection(&self) -> Option<Arc<dyn RemoteConnection>> {
match self {
Self::Connected {
- remote_connection: ssh_connection,
- ..
- } => Some(ssh_connection.clone()),
- Self::HeartbeatMissed { ssh_connection, .. } => Some(ssh_connection.clone()),
- Self::ReconnectFailed { ssh_connection, .. } => Some(ssh_connection.clone()),
+ remote_connection, ..
+ } => Some(remote_connection.clone()),
+ Self::HeartbeatMissed {
+ remote_connection, ..
+ } => Some(remote_connection.clone()),
+ Self::ReconnectFailed {
+ remote_connection, ..
+ } => Some(remote_connection.clone()),
_ => None,
}
}
@@ -230,13 +233,13 @@ impl State {
fn heartbeat_recovered(self) -> Self {
match self {
Self::HeartbeatMissed {
- ssh_connection,
+ remote_connection,
delegate,
multiplex_task,
heartbeat_task,
..
} => Self::Connected {
- remote_connection: ssh_connection,
+ remote_connection: remote_connection,
delegate,
multiplex_task,
heartbeat_task,
@@ -248,26 +251,26 @@ impl State {
fn heartbeat_missed(self) -> Self {
match self {
Self::Connected {
- remote_connection: ssh_connection,
+ remote_connection,
delegate,
multiplex_task,
heartbeat_task,
} => Self::HeartbeatMissed {
missed_heartbeats: 1,
- ssh_connection,
+ remote_connection,
delegate,
multiplex_task,
heartbeat_task,
},
Self::HeartbeatMissed {
missed_heartbeats,
- ssh_connection,
+ remote_connection,
delegate,
multiplex_task,
heartbeat_task,
} => Self::HeartbeatMissed {
missed_heartbeats: missed_heartbeats + 1,
- ssh_connection,
+ remote_connection,
delegate,
multiplex_task,
heartbeat_task,
@@ -493,7 +496,7 @@ impl RemoteClient {
let State::Connected {
multiplex_task,
heartbeat_task,
- remote_connection: ssh_connection,
+ remote_connection,
delegate,
} = state
else {
@@ -511,12 +514,12 @@ impl RemoteClient {
executor.timer(Duration::from_millis(50)).await;
}
- // Drop `multiplex_task` because it owns our ssh_proxy_process, which is a
+ // Drop `multiplex_task` because it owns our remote_connection_proxy_process, which is a
// child of master_process.
drop(multiplex_task);
// Now drop the rest of state, which kills master process.
drop(heartbeat_task);
- drop(ssh_connection);
+ drop(remote_connection);
drop(delegate);
})
}
@@ -540,13 +543,13 @@ impl RemoteClient {
let state = self.state.take().unwrap();
let (attempts, remote_connection, delegate) = match state {
State::Connected {
- remote_connection: ssh_connection,
+ remote_connection,
delegate,
multiplex_task,
heartbeat_task,
}
| State::HeartbeatMissed {
- ssh_connection,
+ remote_connection,
delegate,
multiplex_task,
heartbeat_task,
@@ -554,14 +557,14 @@ impl RemoteClient {
} => {
drop(multiplex_task);
drop(heartbeat_task);
- (0, ssh_connection, delegate)
+ (0, remote_connection, delegate)
}
State::ReconnectFailed {
attempts,
- ssh_connection,
+ remote_connection,
delegate,
..
- } => (attempts, ssh_connection, delegate),
+ } => (attempts, remote_connection, delegate),
State::Connecting
| State::Reconnecting
| State::ReconnectExhausted
@@ -580,18 +583,21 @@ impl RemoteClient {
self.set_state(State::Reconnecting, cx);
- log::info!("Trying to reconnect to ssh server... Attempt {}", attempts);
+ log::info!(
+ "Trying to reconnect to remote server... Attempt {}",
+ attempts
+ );
let unique_identifier = self.unique_identifier.clone();
let client = self.client.clone();
let reconnect_task = cx.spawn(async move |this, cx| {
macro_rules! failed {
- ($error:expr, $attempts:expr, $ssh_connection:expr, $delegate:expr) => {
+ ($error:expr, $attempts:expr, $remote_connection:expr, $delegate:expr) => {
delegate.set_status(Some(&format!("{error:#}", error = $error)), cx);
return State::ReconnectFailed {
error: anyhow!($error),
attempts: $attempts,
- ssh_connection: $ssh_connection,
+ remote_connection: $remote_connection,
delegate: $delegate,
};
};
@@ -600,7 +606,7 @@ impl RemoteClient {
if let Err(error) = remote_connection
.kill()
.await
- .context("Failed to kill ssh process")
+ .context("Failed to kill remote_connection process")
{
failed!(error, attempts, remote_connection, delegate);
};
@@ -611,15 +617,15 @@ impl RemoteClient {
let (incoming_tx, incoming_rx) = mpsc::unbounded::<Envelope>();
let (connection_activity_tx, connection_activity_rx) = mpsc::channel::<()>(1);
- let (ssh_connection, io_task) = match async {
- let ssh_connection = cx
+ let (remote_connection, io_task) = match async {
+ let remote_connection = cx
.update_global(|pool: &mut ConnectionPool, cx| {
pool.connect(connection_options, delegate.clone(), cx)
})?
.await
.map_err(|error| error.cloned())?;
- let io_task = ssh_connection.start_proxy(
+ let io_task = remote_connection.start_proxy(
unique_identifier,
true,
incoming_tx,
@@ -628,11 +634,11 @@ impl RemoteClient {
delegate.clone(),
cx,
);
- anyhow::Ok((ssh_connection, io_task))
+ anyhow::Ok((remote_connection, io_task))
}
.await
{
- Ok((ssh_connection, io_task)) => (ssh_connection, io_task),
+ Ok((remote_connection, io_task)) => (remote_connection, io_task),
Err(error) => {
failed!(error, attempts, remote_connection, delegate);
}
@@ -642,11 +648,11 @@ impl RemoteClient {
client.reconnect(incoming_rx, outgoing_tx, cx);
if let Err(error) = client.resync(HEARTBEAT_TIMEOUT).await {
- failed!(error, attempts, ssh_connection, delegate);
+ failed!(error, attempts, remote_connection, delegate);
};
State::Connected {
- remote_connection: ssh_connection,
+ remote_connection: remote_connection,
delegate,
multiplex_task,
heartbeat_task: Self::heartbeat(this.clone(), connection_activity_rx, cx),
@@ -706,7 +712,7 @@ impl RemoteClient {
cx: &mut AsyncApp,
) -> Task<Result<()>> {
let Ok(client) = this.read_with(cx, |this, _| this.client.clone()) else {
- return Task::ready(Err(anyhow!("SshRemoteClient lost")));
+ return Task::ready(Err(anyhow!("remote_connectionRemoteClient lost")));
};
cx.spawn(async move |cx| {
@@ -719,7 +725,7 @@ impl RemoteClient {
select_biased! {
result = connection_activity_rx.next().fuse() => {
if result.is_none() {
- log::warn!("ssh heartbeat: connection activity channel has been dropped. stopping.");
+ log::warn!("remote heartbeat: connection activity channel has been dropped. stopping.");
return Ok(());
}
@@ -826,7 +832,10 @@ impl RemoteClient {
}
}
Err(error) => {
- log::warn!("ssh io task died with error: {:?}. reconnecting...", error);
+ log::warn!(
+ "remote io task died with error: {:?}. reconnecting...",
+ error
+ );
this.update(cx, |this, cx| {
this.reconnect(cx).ok();
})?;
@@ -884,7 +893,7 @@ impl RemoteClient {
port_forward: Option<(u16, String, u16)>,
) -> Result<CommandTemplate> {
let Some(connection) = self.remote_connection() else {
- return Err(anyhow!("no ssh connection"));
+ return Err(anyhow!("no remote connection"));
};
connection.build_command(program, args, env, working_dir, port_forward)
}
@@ -894,7 +903,7 @@ impl RemoteClient {
forwards: Vec<(u16, String, u16)>,
) -> Result<CommandTemplate> {
let Some(connection) = self.remote_connection() else {
- return Err(anyhow!("no ssh connection"));
+ return Err(anyhow!("no remote connection"));
};
connection.build_forward_ports_command(forwards)
}
@@ -906,7 +915,7 @@ impl RemoteClient {
cx: &App,
) -> Task<Result<()>> {
let Some(connection) = self.remote_connection() else {
- return Task::ready(Err(anyhow!("no ssh connection")));
+ return Task::ready(Err(anyhow!("no remote connection")));
};
connection.upload_directory(src_path, dest_path, cx)
}
@@ -1067,11 +1076,11 @@ impl ConnectionPool {
);
return task.clone();
}
- Some(ConnectionPoolEntry::Connected(ssh)) => {
- if let Some(ssh) = ssh.upgrade()
- && !ssh.has_been_killed()
+ Some(ConnectionPoolEntry::Connected(remote)) => {
+ if let Some(remote) = remote.upgrade()
+ && !remote.has_been_killed()
{
- return Task::ready(Ok(ssh)).shared();
+ return Task::ready(Ok(remote)).shared();
}
self.connections.remove(&opts);
}
@@ -1314,7 +1323,7 @@ impl ChannelClient {
if let Some(proto::envelope::Payload::FlushBufferedMessages(_)) = &incoming.payload
{
log::debug!(
- "{}:ssh message received. name:FlushBufferedMessages",
+ "{}:remote message received. name:FlushBufferedMessages",
this.name
);
{
@@ -1363,13 +1372,13 @@ impl ChannelClient {
this.clone().into(),
cx.clone(),
) {
- log::debug!("{}:ssh message received. name:{type_name}", this.name);
+ log::debug!("{}:remote message received. name:{type_name}", this.name);
cx.foreground_executor()
.spawn(async move {
match future.await {
Ok(_) => {
log::debug!(
- "{}:ssh message handled. name:{type_name}",
+ "{}:remote message handled. name:{type_name}",
this.name
);
}
@@ -1394,7 +1403,7 @@ impl ChannelClient {
})
.detach()
} else {
- log::error!("{}:unhandled ssh message name:{type_name}", this.name);
+ log::error!("{}:unhandled remote message name:{type_name}", this.name);
if let Err(e) = AnyProtoClient::from(this.clone()).send_response(
message_id,
anyhow::anyhow!("no handler registered for {type_name}").to_proto(),
@@ -1433,12 +1442,12 @@ impl ChannelClient {
payload: T,
use_buffer: bool,
) -> impl 'static + Future<Output = Result<T::Response>> {
- log::debug!("ssh request start. name:{}", T::NAME);
+ log::debug!("remote request start. name:{}", T::NAME);
let response =
self.request_dynamic(payload.into_envelope(0, None, None), T::NAME, use_buffer);
async move {
let response = response.await?;
- log::debug!("ssh request finish. name:{}", T::NAME);
+ log::debug!("remote request finish. name:{}", T::NAME);
T::Response::from_envelope(response).context("received a response of the wrong type")
}
}
@@ -1480,7 +1489,7 @@ impl ChannelClient {
}
fn send<T: EnvelopedMessage>(&self, payload: T) -> Result<()> {
- log::debug!("ssh send name:{}", T::NAME);
+ log::debug!("remote send name:{}", T::NAME);
self.send_dynamic(payload.into_envelope(0, None, None))
}