Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
util::ConnectionHandler Class Referenceabstract
+ Inheritance diagram for util::ConnectionHandler:
+ Collaboration diagram for util::ConnectionHandler:

Public Types

using ptr_t = ::boost::intrusive_ptr< ConnectionHandler >
 
using io_context = ::boost::asio::io_context
 
using member_hook_t = detail::member_hook< ConnectionHandler, detail::connection_hook, &ConnectionHandler::hook_ >
 
using flush_hook_t = detail::member_hook< ConnectionHandler, detail::connection_hook, &ConnectionHandler::flush_hook_ >
 

Public Member Functions

 ConnectionHandler (IoContext *context) noexcept
 
void Init (::boost::asio::ip::tcp::socket &&sock)
 
void Close ()
 
IoContextcontext ()
 

Protected Member Functions

virtual bool FlushWrites ()
 Called to flush pending writes to the socket. Returns true if flush took place,.
 
virtual void OnOpenSocket ()
 Called once after connection was initialized. Will run in io context thread of this handler.
 
virtual void OnCloseSocket ()
 Called before ConnectionHandler destroyed but after the socket was signalled to stop and shutdown. More...
 
virtual boost::system::error_code HandleRequest ()=0
 

Protected Attributes

absl::optional< FiberSyncSocketsocket_
 
IoContextio_context_
 
bool use_flusher_fiber_ = false
 

Friends

void intrusive_ptr_add_ref (ConnectionHandler *ctx) noexcept
 
void intrusive_ptr_release (ConnectionHandler *ctx) noexcept
 

Detailed Description

Definition at line 33 of file connection_handler.h.

Member Function Documentation

◆ OnCloseSocket()

virtual void util::ConnectionHandler::OnCloseSocket ( )
inlineprotectedvirtual

Called before ConnectionHandler destroyed but after the socket was signalled to stop and shutdown.

The function implementation may block the calling fiber. Derived ConnectionHandler should clean here resources that must closed before the object is destroyed. Will run in io context thread of the socket.

Definition at line 101 of file connection_handler.h.

Member Data Documentation

◆ use_flusher_fiber_

bool util::ConnectionHandler::use_flusher_fiber_ = false
protected

If set to true, the frameworks will setup a flusher fiber that will call FlushWrites() method few times per msec.

Definition at line 113 of file connection_handler.h.


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