userver: components::TcpAcceptorBase Class Reference
Loading...
Searching...
No Matches
components::TcpAcceptorBase Class Referenceabstract

#include <userver/components/tcp_acceptor_base.hpp>

Detailed Description

Component for accepting incoming TCP connections.

Each accepted socket is processed in a new coroutine by ProcessSocket of the derived class.

Static options:

Name Description Default value
port port to listen on -
unix-socket unix socket to listen on instead of listening on a port ''
task_processor task processor to accept incoming connections -
backlog max count of new connections pending acceptance 1024
no_delay whether to set the TCP_NODELAY option on incoming sockets true
sockets_task_processor task processor to process accepted sockets value of task_processor
See also
TCP half-duplex server with static configs validation
Examples
samples/tcp_full_duplex_service/tcp_full_duplex_service.cpp, and samples/tcp_service/tcp_service.cpp.

Definition at line 41 of file tcp_acceptor_base.hpp.

+ Inheritance diagram for components::TcpAcceptorBase:

Public Member Functions

 TcpAcceptorBase (const ComponentConfig &, const ComponentContext &)
 
ComponentHealth GetComponentHealth () const override
 
void OnLoadingCancelled () override
 

Static Public Member Functions

static yaml_config::Schema GetStaticConfigSchema ()
 

Protected Types

using LoggableComponentBase = ComponentBase
 Legacy alias, use ComponentBase instead.
 

Protected Member Functions

virtual void ProcessSocket (engine::io::Socket &&sock)=0
 

Member Typedef Documentation

◆ LoggableComponentBase

Legacy alias, use ComponentBase instead.

Definition at line 69 of file component_base.hpp.

Member Function Documentation

◆ GetComponentHealth()

ComponentHealth components::ComponentBase::GetComponentHealth ( ) const
inlineoverridevirtualinherited

Override this function to inform the world of the state of your component.

Warning
The function is called concurrently from multiple threads.

Reimplemented from components::RawComponentBase.

Definition at line 35 of file component_base.hpp.

◆ OnLoadingCancelled()

void components::ComponentBase::OnLoadingCancelled ( )
inlineoverridevirtualinherited

Called once if the creation of any other component failed. If the current component expects some other component to take any action with the current component, this call is a signal that such action may never happen due to components loading was cancelled. Application components might not want to override it.

Reimplemented from components::RawComponentBase.

Definition at line 44 of file component_base.hpp.

◆ ProcessSocket()

virtual void components::TcpAcceptorBase::ProcessSocket ( engine::io::Socket && sock)
protectedpure virtual

Override this function to process incoming sockets.

Warning
The function is called concurrently from multiple threads on each new socket.

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