[−][src]Struct grin_p2p::Peer
Fields
info: PeerInfo
Methods
impl Peer
[src]
impl Peer
pub fn accept(
conn: &mut TcpStream,
capab: Capabilities,
total_difficulty: Difficulty,
hs: &Handshake,
adapter: Arc<dyn NetAdapter>
) -> Result<Peer, Error>
[src]
pub fn accept(
conn: &mut TcpStream,
capab: Capabilities,
total_difficulty: Difficulty,
hs: &Handshake,
adapter: Arc<dyn NetAdapter>
) -> Result<Peer, Error>
pub fn connect(
conn: &mut TcpStream,
capab: Capabilities,
total_difficulty: Difficulty,
self_addr: SocketAddr,
hs: &Handshake,
na: Arc<dyn NetAdapter>
) -> Result<Peer, Error>
[src]
pub fn connect(
conn: &mut TcpStream,
capab: Capabilities,
total_difficulty: Difficulty,
self_addr: SocketAddr,
hs: &Handshake,
na: Arc<dyn NetAdapter>
) -> Result<Peer, Error>
pub fn start(&mut self, conn: TcpStream)
[src]
pub fn start(&mut self, conn: TcpStream)
Main peer loop listening for messages and forwarding to the rest of the system.
pub fn is_denied(config: &P2PConfig, peer_addr: &SocketAddr) -> bool
[src]
pub fn is_denied(config: &P2PConfig, peer_addr: &SocketAddr) -> bool
pub fn is_connected(&self) -> bool
[src]
pub fn is_connected(&self) -> bool
Whether this peer is still connected.
pub fn is_banned(&self) -> bool
[src]
pub fn is_banned(&self) -> bool
Whether this peer has been banned.
pub fn is_stuck(&self) -> (bool, Difficulty)
[src]
pub fn is_stuck(&self) -> (bool, Difficulty)
Whether this peer is stuck on sync.
pub fn sent_bytes(&self) -> Option<u64>
[src]
pub fn sent_bytes(&self) -> Option<u64>
Number of bytes sent to the peer
pub fn received_bytes(&self) -> Option<u64>
[src]
pub fn received_bytes(&self) -> Option<u64>
Number of bytes received from the peer
pub fn set_banned(&self)
[src]
pub fn set_banned(&self)
Set this peer status to banned
pub fn send_ping(
&self,
total_difficulty: Difficulty,
height: u64
) -> Result<(), Error>
[src]
pub fn send_ping(
&self,
total_difficulty: Difficulty,
height: u64
) -> Result<(), Error>
Send a ping to the remote peer, providing our local difficulty and height
pub fn send_ban_reason(&self, ban_reason: ReasonForBan)
[src]
pub fn send_ban_reason(&self, ban_reason: ReasonForBan)
Send the ban reason before banning
pub fn send_block(&self, b: &Block) -> Result<bool, Error>
[src]
pub fn send_block(&self, b: &Block) -> Result<bool, Error>
Sends the provided block to the remote peer. The request may be dropped if the remote peer is known to already have the block.
pub fn send_compact_block(&self, b: &CompactBlock) -> Result<bool, Error>
[src]
pub fn send_compact_block(&self, b: &CompactBlock) -> Result<bool, Error>
pub fn send_header(&self, bh: &BlockHeader) -> Result<bool, Error>
[src]
pub fn send_header(&self, bh: &BlockHeader) -> Result<bool, Error>
pub fn send_transaction(&self, tx: &Transaction) -> Result<bool, Error>
[src]
pub fn send_transaction(&self, tx: &Transaction) -> Result<bool, Error>
Sends the provided transaction to the remote peer. The request may be dropped if the remote peer is known to already have the transaction.
pub fn send_stem_transaction(&self, tx: &Transaction) -> Result<(), Error>
[src]
pub fn send_stem_transaction(&self, tx: &Transaction) -> Result<(), Error>
Sends the provided stem transaction to the remote peer. Note: tracking adapter is ignored for stem transactions (while under embargo).
pub fn send_header_request(&self, locator: Vec<Hash>) -> Result<(), Error>
[src]
pub fn send_header_request(&self, locator: Vec<Hash>) -> Result<(), Error>
Sends a request for block headers from the provided block locator
pub fn send_block_request(&self, h: Hash) -> Result<(), Error>
[src]
pub fn send_block_request(&self, h: Hash) -> Result<(), Error>
Sends a request for a specific block by hash
pub fn send_compact_block_request(&self, h: Hash) -> Result<(), Error>
[src]
pub fn send_compact_block_request(&self, h: Hash) -> Result<(), Error>
Sends a request for a specific compact block by hash
pub fn send_peer_request(&self, capab: Capabilities) -> Result<(), Error>
[src]
pub fn send_peer_request(&self, capab: Capabilities) -> Result<(), Error>
pub fn send_txhashset_request(
&self,
height: u64,
hash: Hash
) -> Result<(), Error>
[src]
pub fn send_txhashset_request(
&self,
height: u64,
hash: Hash
) -> Result<(), Error>
pub fn stop(&self)
[src]
pub fn stop(&self)
Stops the peer, closing its connection
Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> SafeBorrow for T where
T: ?Sized,
impl<T> SafeBorrow for T where
T: ?Sized,
fn borrow_replacement(ptr: &T) -> &T
fn borrow_replacement(ptr: &T) -> &T
Given ptr
, which was obtained from a prior call to Self::borrow()
, return a value with the same nominal lifetime which is guaranteed to survive mutations to Self
. Read more
impl<T> UnsafeAny for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,
impl<T> Erased for T
impl<T> Erased for T
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self