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
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/kcserver/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kcserver"
version = "0.1.59"
version = "0.1.60"
rust-version.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
19 changes: 15 additions & 4 deletions crates/kcserver/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@ async fn create_tcp_server(
let builder = HttpBuilder::new(TokioExecutor::new());
// Use serve_connection_with_upgrades to support WebSocket upgrades
if let Err(e) = builder.serve_connection_with_upgrades(io, &mut svc).await {
log::error!("Error serving connection: {}", e);
// Connection shutdown errors are common and expected when clients
// disconnect - only log at debug level to avoid noise
log::debug!("TCP connection ended ({}): {}", addr, e);
}
});
}
Expand All @@ -354,7 +356,7 @@ async fn create_unix_server(
log_level,
true,
socket_dir,
main_server_socket,
main_server_socket.clone(),
);
let server = config.create_server();

Expand All @@ -365,6 +367,9 @@ async fn create_unix_server(
let service = kallichore_api::server::context::MakeAddContext::<_, EmptyContext>::new(service);
let service = Arc::new(service);

// Clone socket path for use in the async block
let socket_path_for_logging = main_server_socket.clone();

// Create the server future that accepts connections on Unix domain socket
let server_future = async move {
loop {
Expand All @@ -378,6 +383,7 @@ async fn create_unix_server(

let io = TokioIo::new(stream);
let make_service = service.clone();
let socket_path = socket_path_for_logging.clone();

tokio::spawn(async move {
// For Unix sockets, we use () as the target since there's no addr
Expand All @@ -393,7 +399,10 @@ async fn create_unix_server(
let builder = HttpBuilder::new(TokioExecutor::new());
// Use serve_connection_with_upgrades to support WebSocket upgrades
if let Err(e) = builder.serve_connection_with_upgrades(io, &mut svc).await {
log::error!("Error serving Unix socket connection: {}", e);
// Connection shutdown errors are common and expected when clients
// disconnect - only log at debug level to avoid noise
let socket_info = socket_path.as_deref().unwrap_or("unknown");
log::debug!("Unix socket connection ended ({}): {}", socket_info, e);
Comment on lines +402 to +405

Copilot AI Dec 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logging change to debug level for connection errors is only applied to Unix sockets. For consistency, the same change should be applied to the TCP server (line 333) and Windows named pipe server (line 474), as connection shutdown errors are equally common and expected in those contexts when clients disconnect.

Copilot uses AI. Check for mistakes.
}
});
}
Expand Down Expand Up @@ -464,7 +473,9 @@ async fn create_named_pipe_server(
let builder = HttpBuilder::new(TokioExecutor::new());
// Use serve_connection_with_upgrades to support WebSocket upgrades
if let Err(e) = builder.serve_connection_with_upgrades(io, &mut svc).await {
log::error!("Error serving named pipe connection: {}", e);
// Connection shutdown errors are common and expected when clients
// disconnect - only log at debug level to avoid noise
log::debug!("Named pipe connection ended: {}", e);
}
});
}
Expand Down