VoicePlane

Struct VoicePlane 

Source
pub struct VoicePlane { /* private fields */ }
Expand description

The UDP plane.

Implementations§

Source§

impl VoicePlane

Source

pub fn new( socket: Arc<UdpSocket>, peers: Arc<Peers>, config: GatewayConfig, ) -> VoicePlane

Source

pub async fn run(&self) -> Result<()>

Service datagrams until the socket errors. Runs for the life of the gateway.

§Errors

Only when the socket itself fails. One bad datagram never ends the plane.

Source

pub fn handle_datagram( &self, datagram: &[u8], from: SocketAddr, ) -> Vec<Datagram>

Process one datagram. All crypto is synchronous and happens here; the caller performs the awaited sends.

Every path ends in an explicit outcome (R6): datagrams to send, a queued tunnel message, or a logged drop.

Source

pub fn route( &self, sender: &Arc<Peer>, audio: &Audio, now: Instant, bytes: usize, ) -> Vec<Datagram>

Route one voice packet from sender, whichever transport it arrived on.

Shared by the UDP plane and the TCP tunnel so both apply the same budget, the same target vocabulary and the same table.

bytes is the decoded packet as it arrived, billed to this connection’s throughput window whichever transport carried it.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.