pub struct Peers { /* private fields */ }Expand description
Every live connection, indexed the four ways the runtime needs.
Registration and removal are explicit rather than RAII on Peer, because
the voice plane holds Arc<Peer> clones across .await points: a peer must
stop being findable the moment its connection ends, while the last
in-flight packet is allowed to finish with the copy it already has.
Implementations§
Source§impl Peers
impl Peers
pub fn new() -> Peers
pub fn insert(&self, peer: Arc<Peer>)
Sourcepub fn remove(&self, connection: ConnectionId) -> Option<Arc<Peer>>
pub fn remove(&self, connection: ConnectionId) -> Option<Arc<Peer>>
Forget a connection. Any address it had proven is released with it, so a later datagram from that address is re-proven rather than delivered to whoever inherits the socket.
pub fn by_connection(&self, connection: ConnectionId) -> Option<Arc<Peer>>
pub fn by_session(&self, session: SessionId) -> Option<Arc<Peer>>
pub fn by_address(&self, address: SocketAddr) -> Option<Arc<Peer>>
Sourcepub fn candidates(&self, host: IpAddr) -> Vec<Arc<Peer>>
pub fn candidates(&self, host: IpAddr) -> Vec<Arc<Peer>>
The connections whose TCP peer shares this host address.
Sourcepub fn bind(&self, address: SocketAddr, peer: &Arc<Peer>)
pub fn bind(&self, address: SocketAddr, peer: &Arc<Peer>)
Bind a proven address to a peer.
The address is rebound, not merged: a client behind a NAT that reassigns its port keeps working, and the old entry is dropped so it cannot deliver to a peer that has moved.
Sourcepub fn on_shard(&self, shard: ShardId) -> Vec<Arc<Peer>>
pub fn on_shard(&self, shard: ShardId) -> Vec<Arc<Peer>>
Every live connection attached to one shard.