fan_out_voice

Function fan_out_voice 

Source
pub async fn fan_out_voice<P: Protocol>(
    socket: &UdpSocket,
    clients: &ClientPool<P>,
    from: SocketAddr,
    module: Module,
    _protocol: ProtocolKind,
    bytes: &[u8],
) -> Result<FanOutReport, ShellError>
Expand description

Fan out the raw wire bytes of a voice frame to every other client on the same module.

The originator (identified by from) is filtered out of the recipient list so the reflector never echoes audio back to the client that sent it.

Individual send failures are logged and the offending peer is marked unhealthy on the client pool; the fan-out loop continues through the rest of the module membership. Peers that cross the crate::client_pool::DEFAULT_UNHEALTHY_THRESHOLD are recorded in the returned FanOutReport::evicted list and the caller is responsible for removing them from the pool. The function only returns Err if a truly fatal condition occurs — currently none, so the Result is reserved for future fatal conditions.

§Errors

Reserved for future fatal conditions (e.g. cross-protocol re-encode errors). The current DExtra-only implementation never returns Err.

§Cancellation safety

This function is not cancel-safe. It iterates the module membership list and calls socket.send_to for each peer in sequence; cancelling the future mid-iteration leaves some peers delivered and others silently skipped, which will make it look like the skipped peers are missing frames. The endpoint run loop is the only expected caller and it awaits this function to completion per datagram.