Enum multistream_select::Version [−][src]
Supported multistream-select protocol versions.
Variants
A lazy variant of version 1 that is identical on the wire but delays sending of protocol negotiation data as much as possible.
Delaying the sending of protocol negotiation data can result in significantly fewer network roundtrips used for the negotiation, up to 0-RTT negotiation.
0-RTT negotiation is achieved if the dialer supports only a single
application protocol. In that case the dialer immedidately settles
on that protocol, buffering the negotiation messages to be sent
with the first round of application protocol data (or an attempt
is made to read from the Negotiated
I/O stream).
A listener receiving a V1Lazy
header will similarly delay sending
of the protocol confirmation. Though typically the listener will need
to read the request data before sending its response, thus triggering
sending of the protocol confirmation, which, in absence of additional
buffering on lower layers will result in at least two response frames
to be sent.
V1Lazy
is specific to rust-libp2p
: While the wire protocol
is identical to V1
, delayed sending of protocol negotiation frames
is only safe under the following assumptions:
-
The dialer is assumed to always send the first multistream-select protocol message immediately after the multistream header, without first waiting for confirmation of that header. Since the listener delays sending the protocol confirmation, a deadlock situation may otherwise occurs that is only resolved by a timeout. This assumption is trivially satisfied if both peers support and use
V1Lazy
. -
When nesting multiple protocol negotiations, the listener is either known to support all of the dialer’s optimistically chosen protocols or there is no intermediate protocol without a payload and none of the protocol payloads has the potential for being mistaken for a multistream-select protocol message. This avoids rare edge-cases whereby the listener may not recognize upgrade boundaries and erroneously process a request despite not supporting one of the intermediate protocols that the dialer committed to. See 1 and 2.
Trait Implementations
impl Clone for Version
[src]
impl Copy for Version
[src]
impl Debug for Version
[src]
impl Default for Version
[src]
impl Eq for Version
[src]
impl PartialEq<Version> for Version
[src]
fn eq(&self, other: &Version) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for Version
[src]
impl StructuralPartialEq for Version
[src]
Auto Trait Implementations
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnwindSafe for Version
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,