Back to Site
Loading...
Searching...
No Matches
librats::CircuitService Class Referenceabstract

#include <circuit_service.h>

Inheritance diagram for librats::CircuitService:
[legend]

Public Member Functions

virtual ~CircuitService ()=default
 
virtual std::optional< PeerRoute > adopt_circuit (const PeerId &carrier, std::unique_ptr< Link > link, ConnRole role, bool connected)=0
 Adopt link as a connection carried by the peer carrier, on the reactor that owns the carrier's own connection.
 
virtual void wake_circuit (PeerRoute route, uint32_t events)=0
 Deliver poll-equivalent events (PollIn / PollOut / PollErr, see core/io_poller.h) to a circuit connection — the events a socket-backed link would have got from the poller.
 
virtual void close_circuit (PeerRoute route, CloseReason reason)=0
 Tear a circuit connection down.
 

Detailed Description

Definition at line 52 of file circuit_service.h.

Constructor & Destructor Documentation

◆ ~CircuitService()

virtual librats::CircuitService::~CircuitService ( )
virtualdefault

Member Function Documentation

◆ adopt_circuit()

virtual std::optional< PeerRoute > librats::CircuitService::adopt_circuit ( const PeerId carrier,
std::unique_ptr< Link >  link,
ConnRole  role,
bool  connected 
)
pure virtual

Adopt link as a connection carried by the peer carrier, on the reactor that owns the carrier's own connection.

Parameters
roleOutbound for a circuit we opened, Inbound for one opened to us. It is what the secure handshake and the peer table's duplicate resolution read, so it must say who asked.
connectedwhether the far end is already there. An inbound circuit is (the opener would not have sent it otherwise); an outbound one is not until its acceptance arrives, and until then the connection waits in Connecting for a PollOut.
Returns
the new connection's route, or nullopt when the carrier is no longer a peer, or when an inbound circuit would push this node past its peer limit. Nothing is started in that case and link is released.

Implemented in librats::Node.

◆ close_circuit()

virtual void librats::CircuitService::close_circuit ( PeerRoute  route,
CloseReason  reason 
)
pure virtual

Tear a circuit connection down.

Thread-safe; a no-op for a route that is already gone.

Implemented in librats::Node.

◆ wake_circuit()

virtual void librats::CircuitService::wake_circuit ( PeerRoute  route,
uint32_t  events 
)
pure virtual

Deliver poll-equivalent events (PollIn / PollOut / PollErr, see core/io_poller.h) to a circuit connection — the events a socket-backed link would have got from the poller.

Thread-safe, and a no-op for a route that is already gone.

Implemented in librats::Node.


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