[−][src]Struct murmel::p2p::P2P
The P2P network layer
Fields
config: Config
Methods
impl<Message: Version + Send + Sync + Clone, Envelope: Command + Send + Sync, Config: P2PConfig<Message, Envelope> + Send + Sync> P2P<Message, Envelope, Config>
[src]
pub fn new(
config: Config,
dispatcher: PeerMessageSender<Message>,
back_pressure: usize
) -> (Arc<P2P<Message, Envelope, Config>>, P2PControlSender<Message>)
[src]
config: Config,
dispatcher: PeerMessageSender<Message>,
back_pressure: usize
) -> (Arc<P2P<Message, Envelope, Config>>, P2PControlSender<Message>)
create a new P2P network controller
pub fn connected_peers(&self) -> Vec<SocketAddr>
[src]
pub fn n_connected_peers(&self) -> usize
[src]
pub fn add_peer(
&self,
network: &'static str,
source: PeerSource
) -> impl Future<Output = Result<SocketAddr, Error>> + Send
[src]
&self,
network: &'static str,
source: PeerSource
) -> impl Future<Output = Result<SocketAddr, Error>> + Send
return a future that does not complete until the peer is connected
pub fn poll_events(
&self,
network: &'static str,
needed_services: u64,
spawn: &mut dyn Spawn
)
[src]
&self,
network: &'static str,
needed_services: u64,
spawn: &mut dyn Spawn
)
run the message dispatcher loop this method does not return unless there is an error obtaining network events run in its own thread, which will process all network events
Auto Trait Implementations
impl<Message, Envelope, Config> Send for P2P<Message, Envelope, Config>
impl<Message, Envelope, Config> Unpin for P2P<Message, Envelope, Config> where
Config: Unpin,
Envelope: Unpin,
Config: Unpin,
Envelope: Unpin,
impl<Message, Envelope, Config> Sync for P2P<Message, Envelope, Config>
impl<Message, Envelope, Config> !UnwindSafe for P2P<Message, Envelope, Config>
impl<Message, Envelope, Config> !RefUnwindSafe for P2P<Message, Envelope, Config>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for 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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,