fix(ipc): Improve server code correctness, logging, and doc comments (#16372)

This commit is contained in:
Torprius
2025-05-21 12:07:54 +02:00
committed by GitHub
parent 608ed5938b
commit c5fc1db888
2 changed files with 6 additions and 6 deletions

View File

@@ -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<HttpMiddleware, RpcMiddleware> Builder<HttpMiddleware, RpcMiddleware> {
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<HttpMiddleware, RpcMiddleware> Builder<HttpMiddleware, RpcMiddleware> {
/// 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

View File

@@ -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);