From c5fc1db8887d5c901847af259eab0dbe0cc313be Mon Sep 17 00:00:00 2001 From: Torprius Date: Wed, 21 May 2025 12:07:54 +0200 Subject: [PATCH] fix(ipc): Improve server code correctness, logging, and doc comments (#16372) --- crates/rpc/ipc/src/server/mod.rs | 6 +++--- crates/rpc/ipc/src/server/rpc_service.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/rpc/ipc/src/server/mod.rs b/crates/rpc/ipc/src/server/mod.rs index 95e3332ef3..818761f447 100644 --- a/crates/rpc/ipc/src/server/mod.rs +++ b/crates/rpc/ipc/src/server/mod.rs @@ -256,7 +256,7 @@ pub struct IpcServerStartError { /// Data required by the server to handle requests received via an IPC connection #[derive(Debug, Clone)] -#[expect(dead_code)] +#[allow(dead_code)] pub(crate) struct ServiceData { /// Registered server methods. pub(crate) methods: Methods, @@ -612,7 +612,7 @@ impl Builder { self } - /// Set the maximum number of connections allowed. Default is 1024. + /// Set the maximum number of subscriptions per connection. Default is 1024. pub const fn max_subscriptions_per_connection(mut self, max: u32) -> Self { self.settings.max_subscriptions_per_connection = max; self @@ -620,7 +620,7 @@ impl Builder { /// The server enforces backpressure which means that /// `n` messages can be buffered and if the client - /// can't keep with up the server. + /// can't keep up with the server. /// /// This `capacity` is applied per connection and /// applies globally on the connection which implies diff --git a/crates/rpc/ipc/src/server/rpc_service.rs b/crates/rpc/ipc/src/server/rpc_service.rs index 10e513b442..75bd53ad6d 100644 --- a/crates/rpc/ipc/src/server/rpc_service.rs +++ b/crates/rpc/ipc/src/server/rpc_service.rs @@ -25,7 +25,7 @@ pub struct RpcService { } /// Configuration of the `RpcService`. -#[expect(dead_code)] +#[allow(dead_code)] #[derive(Clone, Debug)] pub(crate) enum RpcServiceCfg { /// The server supports only calls. @@ -88,7 +88,7 @@ impl RpcServiceT for RpcService { id_provider, } = &self.cfg else { - tracing::warn!("Subscriptions not supported"); + tracing::warn!(id = ?id, method = %name, "Attempted subscription on a service not configured for subscriptions."); let rp = MethodResponse::error(id, ErrorObject::from(ErrorCode::InternalError)); return ResponseFuture::ready(rp); @@ -115,7 +115,7 @@ impl RpcServiceT for RpcService { // happen! let RpcServiceCfg::CallsAndSubscriptions { .. } = self.cfg else { - tracing::warn!("Subscriptions not supported"); + tracing::warn!(id = ?id, method = %name, "Attempted unsubscription on a service not configured for subscriptions."); let rp = MethodResponse::error(id, ErrorObject::from(ErrorCode::InternalError)); return ResponseFuture::ready(rp);