Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/agents/agent-tauri/src-tauri/src/helpers/paths.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
/// Expands `~` in paths to the `$HOME` directory.
///
/// Canonicalizes `$HOME` first: on OSTree/atomic distros (Bazzite, Anatase)
/// `/home` is a symlink to `/var/home`, and Steam's sandboxed runtime
/// (pressure-vessel) does not resolve it — a shortcut written as
/// `/home/user/...` fails to launch (`chdir` ENOENT) even though the path
/// is valid outside the sandbox.
pub(crate) fn expand_path(path: &str) -> String {
if path.starts_with("~/")
&& let Ok(home) = std::env::var("HOME")
{
let home = std::fs::canonicalize(&home)
.map(|p| p.to_string_lossy().into_owned())
.unwrap_or(home);
return format!("{}{}", home, &path[1..]);
}
path.to_string()
Expand Down
2 changes: 1 addition & 1 deletion crates/agent-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub enum ServerError {
Io(#[from] std::io::Error),

#[error("WebSocket error: {0}")]
WebSocket(#[from] tokio_tungstenite::tungstenite::Error),
WebSocket(#[from] Box<tokio_tungstenite::tungstenite::Error>),

#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
Expand Down
4 changes: 3 additions & 1 deletion crates/agent-server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ impl<H: Handler> AgentServer<H> {
let mut ws_config = tokio_tungstenite::tungstenite::protocol::WebSocketConfig::default();
ws_config.max_message_size = Some(WS_MAX_MESSAGE_SIZE);
ws_config.max_frame_size = Some(WS_MAX_MESSAGE_SIZE);
let ws_stream = accept_async_with_config(stream, Some(ws_config)).await?;
let ws_stream = accept_async_with_config(stream, Some(ws_config))
.await
.map_err(Box::new)?;
tracing::info!(%peer_addr, "WebSocket connection established");

let meta = HubMeta {
Expand Down
2 changes: 1 addition & 1 deletion crates/hub-connection/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl ConnectionManager {
cancel_any_reconnect(&self.reconnect_cancel);
// Set any Reconnecting agents to Disconnected.
let mut states = self.state.write().await;
for (_, state) in states.iter_mut() {
for state in states.values_mut() {
if matches!(state, ConnectionState::Reconnecting { .. }) {
*state = ConnectionState::Disconnected;
}
Expand Down
6 changes: 4 additions & 2 deletions crates/hub-connection/src/ws_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use capydeploy_protocol::messages::{
#[derive(Debug, thiserror::Error)]
pub enum WsError {
#[error("WebSocket error: {0}")]
Ws(#[from] tungstenite::Error),
Ws(#[from] Box<tungstenite::Error>),

#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
Expand Down Expand Up @@ -88,7 +88,9 @@ impl WsClient {
ws_config.max_message_size = Some(WS_MAX_MESSAGE_SIZE);
ws_config.max_frame_size = Some(WS_MAX_MESSAGE_SIZE);
let (ws_stream, _) =
tokio_tungstenite::connect_async_with_config(url, Some(ws_config), false).await?;
tokio_tungstenite::connect_async_with_config(url, Some(ws_config), false)
.await
.map_err(Box::new)?;
let (write, read) = ws_stream.split();

let (write_tx, write_rx) = mpsc::channel::<tungstenite::Message>(256);
Expand Down