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

#include <peer.h>

Public Member Functions

const PeerId & id () const noexcept
bool send (std::string_view channel, ByteView payload, SendOptions options={}) 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< PeerInfo > info () const
 Look up the peer's metadata in the directory (nullopt if gone).

Friends

class Node

Detailed Description

Definition at line 29 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 31 of file peer.h.

Referenced by Node.

◆ 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,
SendOptions options = {} ) 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. options as for Node::send().

◆ Node

friend class Node
friend

Definition at line 53 of file peer.h.

References id(), and Node.

Referenced by Node.


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