pub struct DualStack<'set, 'sockets> { /* private fields */ }Expand description
A family-aware UdpIo over a v4 and/or v6 smoltcp UDP socket living in a
shared SocketSet — the smoltcp transport (single- OR dual-stack), mirroring
hick-embassy’s DualUdp.
The engine fans every multicast to BOTH groups, so each datagram must reach the
socket of ITS OWN family rather than be enqueued on a mismatched one (which
would panic or be silently dropped). try_send routes by the destination’s
family and reports SendError::Unsupported for an absent family (the engine
then confirms on the family it has); try_recv alternates the two sockets
round-robin so a sustained backlog on one family cannot starve the other under
the engine’s per-pump RX cap. For a SINGLE-stack node, leave the absent family’s
handle None — the family-explicit replacement for naively pumping one raw socket.
pump borrows the SocketSet for the duration of one step; build a fresh
DualStack each step (it is a thin view) with DualStack::new, e.g.
engine.pump(now, &mut DualStack::new(sockets, Some(h4), Some(h6)), buf).
Implementations§
Source§impl<'set, 'sockets> DualStack<'set, 'sockets>
impl<'set, 'sockets> DualStack<'set, 'sockets>
Sourcepub fn new(
sockets: &'set mut SocketSet<'sockets>,
v4: Option<SocketHandle>,
v6: Option<SocketHandle>,
) -> Self
pub fn new( sockets: &'set mut SocketSet<'sockets>, v4: Option<SocketHandle>, v6: Option<SocketHandle>, ) -> Self
Build the transport view for one pump step over a v4 and/or v6 socket living in
sockets. Pass None for an absent family on a single-stack node.
Trait Implementations§
Source§impl UdpIo for DualStack<'_, '_>
impl UdpIo for DualStack<'_, '_>
Source§fn try_recv(&mut self, buf: &mut [u8]) -> Option<RecvMeta>
fn try_recv(&mut self, buf: &mut [u8]) -> Option<RecvMeta>
buf, returning its metadata, or None
when the receive queue is empty. Non-blocking.Source§fn try_send(&mut self, buf: &[u8], dst: SocketAddr) -> Result<(), SendError>
fn try_send(&mut self, buf: &[u8], dst: SocketAddr) -> Result<(), SendError>
dst. Non-blocking; returns SendError::Busy
when the transmit queue is full, or SendError::Unsupported when there is
no socket / route for the datagram’s address family.