TARAXA
taraxa::net::WsServer Class Referenceabstract

#include <ws_server.hpp>

Collaboration diagram for taraxa::net::WsServer:

Public Member Functions

 WsServer (std::shared_ptr< util::ThreadPool > thread_pool, tcp::endpoint endpoint, addr_t node_addr, uint32_t max_pending_tasks)
 
virtual ~WsServer ()
 
 WsServer (const WsServer &)=delete
 
 WsServer (WsServer &&)=delete
 
WsServeroperator= (const WsServer &)=delete
 
WsServeroperator= (WsServer &&)=delete
 
void run ()
 
void newEthBlock (const ::taraxa::final_chain::BlockHeader &payload, const TransactionHashes &trx_hashes)
 
void newDagBlock (const DagBlock &blk)
 
void newDagBlockFinalized (const blk_hash_t &blk, uint64_t period)
 
void newPbftBlockExecuted (const PbftBlock &sche_blk, const std::vector< blk_hash_t > &finalized_dag_blk_hashes)
 
void newPendingTransaction (const trx_hash_t &trx_hash)
 
void newPillarBlockData (const pillar_chain::PillarBlockData &pillar_block_data)
 
uint32_t numberOfSessions ()
 
uint32_t numberOfPendingTasks () const
 
bool pendingTasksOverLimit () const
 
virtual std::shared_ptr< WsSessioncreateSession (tcp::socket &&socket)=0
 
virtual bool StartListening ()
 
virtual bool StopListening ()
 

Protected Attributes

std::weak_ptr< util::ThreadPoolthread_pool_
 
uint32_t kMaxPendingTasks
 
const addr_t node_addr_
 

Private Member Functions

void do_accept ()
 
void on_accept (beast::error_code ec, tcp::socket socket)
 

Private Attributes

LOG_OBJECTS_DEFINE boost::asio::io_context & ioc_
 
tcp::acceptor acceptor_
 
std::list< std::shared_ptr< WsSession > > sessions
 
std::atomic< bool > stopped_ = false
 
boost::shared_mutex sessions_mtx_
 

Constructor & Destructor Documentation

◆ WsServer() [1/3]

taraxa::net::WsServer::WsServer ( std::shared_ptr< util::ThreadPool thread_pool,
tcp::endpoint  endpoint,
addr_t  node_addr,
uint32_t  max_pending_tasks 
)

◆ ~WsServer()

taraxa::net::WsServer::~WsServer ( )
virtual

◆ WsServer() [2/3]

taraxa::net::WsServer::WsServer ( const WsServer )
delete

◆ WsServer() [3/3]

taraxa::net::WsServer::WsServer ( WsServer &&  )
delete

Member Function Documentation

◆ createSession()

virtual std::shared_ptr<WsSession> taraxa::net::WsServer::createSession ( tcp::socket &&  socket)
pure virtual

◆ do_accept()

void taraxa::net::WsServer::do_accept ( )
private

◆ newDagBlock()

void taraxa::net::WsServer::newDagBlock ( const DagBlock blk)

◆ newDagBlockFinalized()

void taraxa::net::WsServer::newDagBlockFinalized ( const blk_hash_t blk,
uint64_t  period 
)

◆ newEthBlock()

void taraxa::net::WsServer::newEthBlock ( const ::taraxa::final_chain::BlockHeader payload,
const TransactionHashes trx_hashes 
)

◆ newPbftBlockExecuted()

void taraxa::net::WsServer::newPbftBlockExecuted ( const PbftBlock sche_blk,
const std::vector< blk_hash_t > &  finalized_dag_blk_hashes 
)

◆ newPendingTransaction()

void taraxa::net::WsServer::newPendingTransaction ( const trx_hash_t trx_hash)

◆ newPillarBlockData()

void taraxa::net::WsServer::newPillarBlockData ( const pillar_chain::PillarBlockData pillar_block_data)

◆ numberOfPendingTasks()

uint32_t taraxa::net::WsServer::numberOfPendingTasks ( ) const

◆ numberOfSessions()

uint32_t taraxa::net::WsServer::numberOfSessions ( )

◆ on_accept()

void taraxa::net::WsServer::on_accept ( beast::error_code  ec,
tcp::socket  socket 
)
private

◆ operator=() [1/2]

WsServer& taraxa::net::WsServer::operator= ( const WsServer )
delete

◆ operator=() [2/2]

WsServer& taraxa::net::WsServer::operator= ( WsServer &&  )
delete

◆ pendingTasksOverLimit()

bool taraxa::net::WsServer::pendingTasksOverLimit ( ) const
inline

◆ run()

void taraxa::net::WsServer::run ( )

◆ StartListening()

virtual bool taraxa::net::WsServer::StartListening ( )
inlinevirtual

◆ StopListening()

virtual bool taraxa::net::WsServer::StopListening ( )
inlinevirtual

Member Data Documentation

◆ acceptor_

tcp::acceptor taraxa::net::WsServer::acceptor_
private

◆ ioc_

LOG_OBJECTS_DEFINE boost::asio::io_context& taraxa::net::WsServer::ioc_
private

◆ kMaxPendingTasks

uint32_t taraxa::net::WsServer::kMaxPendingTasks
protected

◆ node_addr_

const addr_t taraxa::net::WsServer::node_addr_
protected

◆ sessions

std::list<std::shared_ptr<WsSession> > taraxa::net::WsServer::sessions
private

◆ sessions_mtx_

boost::shared_mutex taraxa::net::WsServer::sessions_mtx_
private

◆ stopped_

std::atomic<bool> taraxa::net::WsServer::stopped_ = false
private

◆ thread_pool_

std::weak_ptr<util::ThreadPool> taraxa::net::WsServer::thread_pool_
protected

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