pub(crate) struct MuxConnection {
send_queues: HashMap<ProtocolID, Arc<AsyncQueue<PeerNetMsg>>>,
recv_queues: HashMap<ProtocolID, Arc<AsyncQueue<ProtocolEvent>>>,
quic_conn: QuicConn,
}Expand description
QUIC path: one stream per protocol, each with its own writer task.
send_queues and recv_queues are keyed by protocol id.
Fields§
§send_queues: HashMap<ProtocolID, Arc<AsyncQueue<PeerNetMsg>>>§recv_queues: HashMap<ProtocolID, Arc<AsyncQueue<ProtocolEvent>>>§quic_conn: QuicConnImplementations§
Source§impl MuxConnection
impl MuxConnection
Sourcepub(crate) async fn from_queued(
queued: QueuedConn,
negotiated: &HashSet<ProtocolID>,
proto_ids: impl IntoIterator<Item = ProtocolID>,
task_group: &TaskGroup,
) -> Result<Self>
pub(crate) async fn from_queued( queued: QueuedConn, negotiated: &HashSet<ProtocolID>, proto_ids: impl IntoIterator<Item = ProtocolID>, task_group: &TaskGroup, ) -> Result<Self>
Open / accept one QUIC stream per negotiated protocol and spawn a reader + writer task for each.
Trait Implementations§
Source§impl PeerConnection for MuxConnection
impl PeerConnection for MuxConnection
Source§fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
proto_id: &'life1 ProtocolID,
payload: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
proto_id: &'life1 ProtocolID,
payload: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send pre-encoded payload bytes for
proto_id.Source§fn recv<'life0, 'life1, 'async_trait>(
&'life0 self,
proto_id: &'life1 ProtocolID,
) -> Pin<Box<dyn Future<Output = Result<ProtocolEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recv<'life0, 'life1, 'async_trait>(
&'life0 self,
proto_id: &'life1 ProtocolID,
) -> Pin<Box<dyn Future<Output = Result<ProtocolEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Pop the next event for
proto_id. Blocks until a message
arrives or shutdown is broadcast.Auto Trait Implementations§
impl Freeze for MuxConnection
impl !RefUnwindSafe for MuxConnection
impl Send for MuxConnection
impl Sync for MuxConnection
impl Unpin for MuxConnection
impl UnsafeUnpin for MuxConnection
impl !UnwindSafe for MuxConnection
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more