pub struct Config { /* private fields */ }
Expand description
Configuration for the multiplexer.
Implementations§
Source§impl Config
impl Config
Sourcepub fn set_max_num_streams(&mut self, max: usize) -> &mut Self
pub fn set_max_num_streams(&mut self, max: usize) -> &mut Self
Sets the maximum number of simultaneously used substreams.
A substream is used as long as it has not been dropped,
even if it may already be closed or reset at the protocol
level (in which case it may still have buffered data that
can be read before the StreamMuxer
API signals EOF).
When the limit is reached, opening of outbound substreams
is delayed until another substream is dropped, whereas new
inbound substreams are immediately answered with a Reset
.
If the number of inbound substreams that need to be reset
accumulates too quickly (judged by internal bounds), the
connection is closed with an error due to the misbehaved
remote.
Sourcepub fn set_max_buffer_size(&mut self, max: usize) -> &mut Self
pub fn set_max_buffer_size(&mut self, max: usize) -> &mut Self
Sets the maximum number of frames buffered per substream.
A limit is necessary in order to avoid DoS attacks.
Sourcepub fn set_max_buffer_behaviour(
&mut self,
behaviour: MaxBufferBehaviour,
) -> &mut Self
pub fn set_max_buffer_behaviour( &mut self, behaviour: MaxBufferBehaviour, ) -> &mut Self
Sets the behaviour when the maximum buffer size is reached for a substream.
See the documentation of MaxBufferBehaviour
.
Sourcepub fn set_split_send_size(&mut self, size: usize) -> &mut Self
pub fn set_split_send_size(&mut self, size: usize) -> &mut Self
Sets the frame size used when sending data. Capped at 1Mbyte as per the Mplex spec.
Sourcepub fn set_protocol_name(&mut self, protocol_name: &'static str) -> &mut Self
pub fn set_protocol_name(&mut self, protocol_name: &'static str) -> &mut Self
Set the protocol name.
use libp2p_mplex::MplexConfig;
let mut muxer_config = MplexConfig::new();
muxer_config.set_protocol_name("/mplex/6.7.0");
Trait Implementations§
Source§impl<C> InboundConnectionUpgrade<C> for Configwhere
C: AsyncRead + AsyncWrite + Unpin,
impl<C> InboundConnectionUpgrade<C> for Configwhere
C: AsyncRead + AsyncWrite + Unpin,
Source§type Output = Multiplex<C>
type Output = Multiplex<C>
Source§type Future = Ready<Result<<Config as InboundConnectionUpgrade<C>>::Output, Error>>
type Future = Ready<Result<<Config as InboundConnectionUpgrade<C>>::Output, Error>>
Source§fn upgrade_inbound(self, socket: C, _: Self::Info) -> Self::Future
fn upgrade_inbound(self, socket: C, _: Self::Info) -> Self::Future
Source§impl<C> OutboundConnectionUpgrade<C> for Configwhere
C: AsyncRead + AsyncWrite + Unpin,
impl<C> OutboundConnectionUpgrade<C> for Configwhere
C: AsyncRead + AsyncWrite + Unpin,
Source§type Output = Multiplex<C>
type Output = Multiplex<C>
Source§type Future = Ready<Result<<Config as OutboundConnectionUpgrade<C>>::Output, Error>>
type Future = Ready<Result<<Config as OutboundConnectionUpgrade<C>>::Output, Error>>
Source§fn upgrade_outbound(self, socket: C, _: Self::Info) -> Self::Future
fn upgrade_outbound(self, socket: C, _: Self::Info) -> Self::Future
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more