[][src]Struct cjdns_snode::peer::Peers

pub struct Peers {
    peers: PeerList,
    anns: Mutex<AnnList>,
    msg_id_seq: Seq,
    announce_tx: Sender<Vec<u8>>,
}

Fields

peers: PeerListanns: Mutex<AnnList>msg_id_seq: Seqannounce_tx: Sender<Vec<u8>>

Implementations

impl Peers[src]

pub fn get_info(&self) -> PeersInfo[src]

impl Peers[src]

const DROP_AFTER: Duration[src]

const PING_AFTER: Duration[src]

const PING_CYCLE: Duration[src]

pub async fn ping_task<'_>(&'_ self)[src]

async fn do_pings<'_>(&'_ self)[src]

impl Peers[src]

const VERSION: u64[src]

impl Peers[src]

fn new(ann_tx: Sender<Vec<u8>>) -> Self[src]

Create new instance of Peers + announce sender

pub async fn connect_to<'_>(&'_ self, uri: Uri)[src]

Asynchronously start connecting to the specified peer supernode. If the connection can't be established or closed by the remote side, it will be reconnected automatically after a delay.

pub async fn accept_incoming_connection<'_>(
    &'_ self,
    from_ipv6: String,
    ws_stream: impl WebSock
) -> Result<(), Error>
[src]

pub async fn add_ann<'_>(&'_ self, hash: AnnHash, binary: Vec<u8>)[src]

pub fn del_ann(&self, hash: &AnnHash)[src]

async fn incoming<'_>(
    &'_ self,
    addr: String,
    ws_stream: impl WebSock
) -> Result<(), Error>
[src]

Handle incoming WebSocket connection and process it until closed. This async fn completes when the connection is closed, so spawn a task for it.

async fn outgoing<'_>(
    &'_ self,
    addr: String,
    ws_stream: impl WebSock
) -> Result<(), Error>
[src]

Handle outgoing WebSocket connection and process it until closed. This async fn completes when the connection is closed, so spawn a task for it.

fn create_peer<'a>(
    &'a self,
    addr: String,
    ws_stream: impl WebSock + 'a,
    peer_type: PeerType
) -> (Peer, impl Future<Output = Result<(), Error>> + 'a)
[src]

fn drop_peer(&self, peer: Peer)[src]

async fn run_websocket<'_>(
    &'_ self,
    peer: Peer,
    ws_stream: impl WebSock,
    msg_rx: Receiver<Message>,
    ann_tx: Sender<Vec<u8>>
) -> Result<(), Error>
[src]

async fn handle_message<'_, '_>(
    &'_ self,
    peer: Peer,
    message: Message,
    ann_tx: &'_ mut Sender<Vec<u8>>
) -> Result<(), Error>
[src]

Auto Trait Implementations

impl !RefUnwindSafe for Peers

impl Send for Peers

impl Sync for Peers

impl Unpin for Peers

impl !UnwindSafe for Peers

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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