Skip to main content

Handoff

Struct Handoff 

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

What Binding::hand_over leaves for the successor: the bound socket and the close packets held for its clients (decisions/0039).

Handoff::into_parts splits it in two. The socket goes to the successor as a descriptor, over SCM_RIGHTS or inherited across exec, and is served there with Listener::bind_quic_socket. The bytes go alongside it to Binding::take_over. They are QUIC packets, readable in the clear only as far as their headers go, and need no secrecy.

They do need the integrity of their channel. Whoever can write them decides what the successor sends from the binding’s UDP port, and to whom: take_over sends each datagram it is given, once. That is bounded and not harmless: it refuses more than 4096 datagrams, one larger than 1500 bytes, and a destination that is multicast, broadcast, unspecified or port 0, none of which a client has — but within those bounds it sends what it is told. The successor cannot check the destinations against connections, because it has none: they were the predecessor’s. So carry the bytes over the channel that carries the socket descriptor, which only the two processes’ own user can reach, and not through a file or socket other users can write.

A binding that holds more than 4096 datagrams keeps the first ones: the clients whose close did not fit notice through Limits::idle_timeout and redial on their normal schedule.

Implementations§

Source§

impl Handoff

Source

pub fn held(&self) -> usize

How many datagrams are held for the successor to send.

Source

pub fn local_addr(&self) -> SocketAddr

The address the socket is bound to.

Source

pub fn into_parts(self) -> (UdpSocket, Vec<u8>)

The socket, and the held datagrams as bytes for Binding::take_over.

Trait Implementations§

Source§

impl Debug for Handoff

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more