pub struct C2ReconnectingEventReceiver { /* private fields */ }Expand description
The event stream for a reconnecting connection. Backed by two bridge
channels created once, before the first physical connection, that only
close when the supervisor itself terminates – a reconnect is invisible
to it. The two channels mirror the split C2EventReceiver already
carries per physical connection (regular events vs. harness_mcp
read-proxy events), so a caller that wants harness_mcp events served
ahead of a regular-event backlog can drain them independently instead
of going through the merged recv().
Implementations§
Source§impl C2ReconnectingEventReceiver
impl C2ReconnectingEventReceiver
Sourcepub async fn recv(&mut self) -> Option<RoutedNodeEvent>
pub async fn recv(&mut self) -> Option<RoutedNodeEvent>
Returns every event from both channels, harness_mcp-first when both
are ready – the exact merge algorithm C2EventReceiver::recv
already implements per physical connection, moved one layer up to
this bridge’s own two channels. Existing callers that only ever call
this method see the identical observable behavior as before the
split: same events, same relative order.
Sourcepub async fn recv_browser(&mut self) -> Option<BrowserStreamEvent>
pub async fn recv_browser(&mut self) -> Option<BrowserStreamEvent>
Drains only the regular-event channel, leaving harness_mcp events untouched.
pub async fn recv_regular(&mut self) -> Option<RoutedNodeEvent>
Sourcepub async fn recv_harness_mcp(&mut self) -> Option<RoutedNodeEvent>
pub async fn recv_harness_mcp(&mut self) -> Option<RoutedNodeEvent>
Drains only the harness_mcp channel, leaving regular events untouched.
Sourcepub fn split_mut(
&mut self,
) -> (&mut Receiver<RoutedNodeEvent>, &mut Receiver<RoutedNodeEvent>)
pub fn split_mut( &mut self, ) -> (&mut Receiver<RoutedNodeEvent>, &mut Receiver<RoutedNodeEvent>)
Splits into two independent mutable borrows, one per channel, so a
caller can race both in a single tokio::select! (the harness
runtime’s own main loop, prioritizing HarnessMcpReadCall ahead of
its regular-event backlog). Two separate recv_regular/
recv_harness_mcp calls cannot be used together in one select!:
each is an &mut self async method, so the future each returns
borrows the whole receiver for its lifetime, and the borrow checker
rejects two such futures coexisting even though they touch disjoint
fields. Splitting once, up front, hands out two genuinely disjoint
borrows instead.