Back to Site
Loading...
Searching...
No Matches
librats::Peer Class Reference

#include <peer.h>

Public Member Functions

const PeerIdid () const noexcept
 
bool send (std::string_view channel, ByteView payload) const
 Send bytes on a named application channel, to this peer over whichever connection currently serves it.
 
void disconnect () const
 Request this peer be disconnected.
 
std::optional< PeerInfoinfo () const
 Look up the peer's metadata in the directory (nullopt if gone).
 

Friends

class Node
 

Detailed Description

Definition at line 28 of file peer.h.

Member Function Documentation

◆ disconnect()

void librats::Peer::disconnect ( ) const

Request this peer be disconnected.

◆ id()

const PeerId & librats::Peer::id ( ) const
inlinenoexcept

Definition at line 30 of file peer.h.

◆ info()

std::optional< PeerInfo > librats::Peer::info ( ) const

Look up the peer's metadata in the directory (nullopt if gone).

◆ send()

bool librats::Peer::send ( std::string_view  channel,
ByteView  payload 
) const

Send bytes on a named application channel, to this peer over whichever connection currently serves it.

Returns
whether that peer's queue still has room — the same answer, and the same contract, as Node::send(): false means stop and wait for on_peer_writable rather than keep going. A handler that replies through this handle is the most ordinary way to write to a peer, so it has to be able to feel backpressure like any other sender; while this returned void it could not, and the bytes it queued were invisible to peer_writable() into the bargain.

Friends And Related Symbol Documentation

◆ Node

friend class Node
friend

Definition at line 51 of file peer.h.


The documentation for this class was generated from the following file: