Enum veloren_network::channel::Protocols
source · pub(crate) enum Protocols {
Tcp((TcpSendProtocol<TcpDrain>, TcpRecvProtocol<TcpSink>)),
Mpsc((MpscSendProtocol<MpscDrain>, MpscRecvProtocol<MpscSink>)),
Quic((QuicSendProtocol<QuicDrain>, QuicRecvProtocol<QuicSink>)),
}
Variants§
Tcp((TcpSendProtocol<TcpDrain>, TcpRecvProtocol<TcpSink>))
Mpsc((MpscSendProtocol<MpscDrain>, MpscRecvProtocol<MpscSink>))
Quic((QuicSendProtocol<QuicDrain>, QuicRecvProtocol<QuicSink>))
Implementations§
source§impl Protocols
impl Protocols
const MPSC_CHANNEL_BOUND: usize = 1_000usize
pub(crate) async fn with_tcp_connect( addr: SocketAddr, metrics: ProtocolMetricCache, ) -> Result<Self, NetworkConnectError>
pub(crate) async fn with_tcp_listen( addr: SocketAddr, cids: Arc<AtomicU64>, metrics: Arc<ProtocolMetrics>, s2s_stop_listening_r: Receiver<()>, c2s_protocol_s: UnboundedSender<(Protocols, ConnectAddr, Cid)>, ) -> Result<()>
pub(crate) fn new_tcp(stream: TcpStream, metrics: ProtocolMetricCache) -> Self
pub(crate) async fn with_mpsc_connect( addr: u64, metrics: ProtocolMetricCache, ) -> Result<Self, NetworkConnectError>
pub(crate) async fn with_mpsc_listen( addr: u64, cids: Arc<AtomicU64>, metrics: Arc<ProtocolMetrics>, s2s_stop_listening_r: Receiver<()>, c2s_protocol_s: UnboundedSender<(Protocols, ConnectAddr, Cid)>, ) -> Result<()>
pub(crate) fn new_mpsc( sender: Sender<MpscMsg>, receiver: Receiver<MpscMsg>, metrics: ProtocolMetricCache, ) -> Self
pub(crate) async fn with_quic_connect( addr: SocketAddr, config: ClientConfig, name: String, metrics: ProtocolMetricCache, ) -> Result<Self, NetworkConnectError>
pub(crate) async fn with_quic_listen( addr: SocketAddr, server_config: ServerConfig, cids: Arc<AtomicU64>, metrics: Arc<ProtocolMetrics>, s2s_stop_listening_r: Receiver<()>, c2s_protocol_s: UnboundedSender<(Protocols, ConnectAddr, Cid)>, ) -> Result<()>
pub(crate) async fn new_quic( connection: Connection, listen: bool, metrics: ProtocolMetricCache, ) -> Result<Self, ConnectionError>
pub(crate) fn split(self) -> (SendProtocols, RecvProtocols)
Trait Implementations§
source§impl InitProtocol for Protocols
impl InitProtocol for Protocols
type CustomErr = ProtocolsError
fn initialize<'life0, 'async_trait>(
&'life0 mut self,
initializer: bool,
local_pid: Pid,
secret: u128,
) -> Pin<Box<dyn Future<Output = Result<(Pid, Sid, u128), InitProtocolError<Self::CustomErr>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for Protocols
impl !RefUnwindSafe for Protocols
impl Send for Protocols
impl Sync for Protocols
impl Unpin for Protocols
impl !UnwindSafe for Protocols
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
Mutably borrows from an owned value. Read more
§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>
Converts
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>
Converts
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