Kagome
Polkadot Runtime Engine in C++17
kagome::api::WsListenerImpl Class Reference

server which listens for incoming connection, accepts connections making session from socket More...

#include <ws_listener_impl.hpp>

Inheritance diagram for kagome::api::WsListenerImpl:
Collaboration diagram for kagome::api::WsListenerImpl:

Public Types

using SessionImpl = WsSession
 
- Public Types inherited from kagome::api::Listener
using Context = RpcContext
 

Public Member Functions

 WsListenerImpl (const std::shared_ptr< application::AppStateManager > &app_state_manager, std::shared_ptr< Context > context, Configuration listener_config, SessionImpl::Configuration session_config)
 
 ~WsListenerImpl () override=default
 
bool prepare () override
 
bool start () override
 
void stop () override
 
void setHandlerForNewSession (NewSessionHandler &&on_new_session) override
 Set handler for working new session. More...
 
- Public Member Functions inherited from kagome::api::Listener
virtual ~Listener ()=default
 

Private Member Functions

void acceptOnce () override
 Accept incoming connection. More...
 

Private Attributes

std::shared_ptr< Contextcontext_
 
const Configuration config_
 
const SessionImpl::Configuration session_config_
 
const uint32_t max_ws_connections_
 
std::unique_ptr< Acceptoracceptor_
 
std::unique_ptr< NewSessionHandleron_new_session_
 
std::atomic< Session::SessionIdnext_session_id_
 
std::shared_ptr< SessionImplnew_session_
 
std::atomic< uint32_t > active_connections_
 
metrics::RegistryPtr registry_ = metrics::createRegistry()
 
metrics::Counteropened_session_
 
metrics::Counterclosed_session_
 
log::Logger log_
 

Additional Inherited Members

- Protected Types inherited from kagome::api::Listener
using Acceptor = boost::asio::ip::tcp::acceptor
 
using Endpoint = boost::asio::ip::tcp::endpoint
 
using NewSessionHandler = std::function< void(const std::shared_ptr< Session > &)>
 

Detailed Description

server which listens for incoming connection, accepts connections making session from socket

Definition at line 26 of file ws_listener_impl.hpp.

Member Typedef Documentation

Constructor & Destructor Documentation

kagome::api::WsListenerImpl::WsListenerImpl ( const std::shared_ptr< application::AppStateManager > &  app_state_manager,
std::shared_ptr< Context context,
Configuration  listener_config,
SessionImpl::Configuration  session_config 
)

Definition at line 18 of file ws_listener_impl.cpp.

kagome::api::WsListenerImpl::~WsListenerImpl ( )
overridedefault

Member Function Documentation

void kagome::api::WsListenerImpl::acceptOnce ( )
overrideprivatevirtual

Accept incoming connection.

Implements kagome::api::Listener.

Definition at line 95 of file ws_listener_impl.cpp.

bool kagome::api::WsListenerImpl::prepare ( )
overridevirtual
See also
AppStateManager::takeControl

Implements kagome::api::Listener.

Definition at line 45 of file ws_listener_impl.cpp.

void kagome::api::WsListenerImpl::setHandlerForNewSession ( NewSessionHandler &&  on_new_session)
overridevirtual

Set handler for working new session.

Implements kagome::api::Listener.

Definition at line 89 of file ws_listener_impl.cpp.

bool kagome::api::WsListenerImpl::start ( )
overridevirtual
See also
AppStateManager::takeControl

Implements kagome::api::Listener.

Definition at line 67 of file ws_listener_impl.cpp.

void kagome::api::WsListenerImpl::stop ( )
overridevirtual
See also
AppStateManager::takeControl

Implements kagome::api::Listener.

Definition at line 83 of file ws_listener_impl.cpp.

Member Data Documentation

std::unique_ptr<Acceptor> kagome::api::WsListenerImpl::acceptor_
private

Definition at line 58 of file ws_listener_impl.hpp.

std::atomic<uint32_t> kagome::api::WsListenerImpl::active_connections_
private

Definition at line 63 of file ws_listener_impl.hpp.

metrics::Counter* kagome::api::WsListenerImpl::closed_session_
private

Definition at line 68 of file ws_listener_impl.hpp.

const Configuration kagome::api::WsListenerImpl::config_
private

Definition at line 54 of file ws_listener_impl.hpp.

std::shared_ptr<Context> kagome::api::WsListenerImpl::context_
private

Definition at line 53 of file ws_listener_impl.hpp.

log::Logger kagome::api::WsListenerImpl::log_
private

Definition at line 70 of file ws_listener_impl.hpp.

const uint32_t kagome::api::WsListenerImpl::max_ws_connections_
private

Definition at line 56 of file ws_listener_impl.hpp.

std::shared_ptr<SessionImpl> kagome::api::WsListenerImpl::new_session_
private

Definition at line 62 of file ws_listener_impl.hpp.

std::atomic<Session::SessionId> kagome::api::WsListenerImpl::next_session_id_
private

Definition at line 61 of file ws_listener_impl.hpp.

std::unique_ptr<NewSessionHandler> kagome::api::WsListenerImpl::on_new_session_
private

Definition at line 59 of file ws_listener_impl.hpp.

metrics::Counter* kagome::api::WsListenerImpl::opened_session_
private

Definition at line 67 of file ws_listener_impl.hpp.

metrics::RegistryPtr kagome::api::WsListenerImpl::registry_ = metrics::createRegistry()
private

Definition at line 66 of file ws_listener_impl.hpp.

const SessionImpl::Configuration kagome::api::WsListenerImpl::session_config_
private

Definition at line 55 of file ws_listener_impl.hpp.


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