pub struct Peer {
own_id: PeerID,
id: PeerID,
peer_pool: Weak<PeerPool>,
direction: ConnDirection,
remote_endpoint: Endpoint,
connection: Arc<dyn PeerConnection>,
disconnect_signal: Sender<Result<()>>,
negotiated_protocols: HashSet<ProtocolID>,
stop_chan: (Sender<Result<()>>, Receiver<Result<()>>),
config: Arc<Config>,
executor: Executor,
task_group: TaskGroup,
}Expand description
A connected peer. Holds a PeerConnection that hides the wire
shape (single framed pipe vs. per-protocol streams).
Fields§
§own_id: PeerID§id: PeerID§peer_pool: Weak<PeerPool>§direction: ConnDirection§remote_endpoint: Endpoint§connection: Arc<dyn PeerConnection>§disconnect_signal: Sender<Result<()>>§negotiated_protocols: HashSet<ProtocolID>§stop_chan: (Sender<Result<()>>, Receiver<Result<()>>)§config: Arc<Config>§executor: Executor§task_group: TaskGroupImplementations§
Source§impl Peer
impl Peer
pub async fn send(&self, proto_id: ProtocolID, msg: Vec<u8>) -> Result<()>
pub async fn recv(&self, proto_id: &ProtocolID) -> Result<ProtocolEvent>
pub async fn broadcast(&self, proto_id: &ProtocolID, msg: Vec<u8>)
pub fn id(&self) -> &PeerID
pub fn own_id(&self) -> &PeerID
pub fn config(&self) -> Arc<Config>
pub fn executor(&self) -> Executor
pub fn remote_endpoint(&self) -> &Endpoint
pub fn is_inbound(&self) -> bool
pub fn direction(&self) -> &ConnDirection
pub fn negotiated_protocols(&self) -> &HashSet<ProtocolID>
pub(crate) async fn run(self: Arc<Self>) -> Result<()>
pub(crate) async fn shutdown(self: &Arc<Self>) -> Result<()>
async fn run_connect_protocols(self: &Arc<Self>)
fn peer_pool(&self) -> Arc<PeerPool>
Source§impl Peer
impl Peer
pub(crate) async fn new( peer_pool: Arc<PeerPool>, queued: QueuedConn, id: PeerID, negotiated_protocols: HashSet<ProtocolID>, protocol_ids: impl IntoIterator<Item = ProtocolID> + Clone, ) -> Result<Arc<Self>>
Auto Trait Implementations§
impl !Freeze for Peer
impl !RefUnwindSafe for Peer
impl Send for Peer
impl Sync for Peer
impl !Unpin for Peer
impl !UnsafeUnpin for Peer
impl !UnwindSafe for Peer
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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