Skip to main content

spawn_streaming_response

Function spawn_streaming_response 

Source
pub fn spawn_streaming_response(service_name: &str, continuation: Continuation)
Expand description

Spawn the server-side half of a streaming RPC — the task that keeps pushing data after the StreamInfo reply has been sent — onto the current LocalSet, bounded by a per-service admission permit.

Replaces the former “transport front-end spawns the continuation it got back from process_request” model (#186): the dispatch core now spawns this task itself and returns only the reply bytes, so the streaming lifecycle is no longer threaded through every transport’s request/response path. This is the M1 shape; in M2 the streaming transport (StreamChannel) moves to a service-owned moq broadcast and this coarse per-service cap is replaced by the StreamOpt backpressure axes (#134).

service_name keys the per-service permit pool (see DEFAULT_MAX_CONCURRENT_STREAMS_PER_SERVICE and install_max_concurrent_streams_per_service). When the pool is saturated the task waits for a permit rather than being dropped — and the wait is logged so saturation is observable rather than a silent stall.

§Invariant

MUST be called from within a tokio::task::LocalSet: the task is ?Send (like every RequestService), and spawn_local panics outside a LocalSet. Every process_request caller already runs on a LocalSet (ZMQ RequestLoop, the WebTransport server, and the generic plane’s LocalServiceBridge), which is the only place this is invoked.