pub async fn serve_rpc_connection<S>(
session: S,
processor: Arc<dyn IrohRequestProcessor>,
signing_key: SigningKey,
stream_limit: Arc<Semaphore>,
read_timeout: Duration,
shutdown: CancellationToken,
carrier: CarrierContext,
) -> Result<()>where
S: Session,Expand description
Serve one accepted [Session] until the peer closes it or shutdown is
cancelled. Terminates hyprstream-rpc/1-style bidi streams, caps concurrent
streams via the shared stream_limit, and (in concert with the caller’s
drain on that same stream_limit) drains in-flight requests on shutdown.
The caller owns the drain: it holds the same Arc<Semaphore> and, on
shutdown, cancels shutdown then acquire_many(capacity)s every permit so
detached handle_stream tasks finish before teardown. This fn only acquires
one per-stream permit per accepted bidi stream.
carrier is the accept boundary’s classification of this session’s
carrier (INV-2 receive side, #1042). Untrusted carriers may invoke only the
crate-owned canonical envelope processor; raw closure processors are
silently refused before their callback can observe request bytes.