13 #include <boost/asio/io_context.hpp> 14 #include <boost/asio/ip/tcp.hpp> 15 #include <boost/asio/post.hpp> 29 using endpoint = boost::asio::ip::tcp::endpoint;
47 template <
typename FunctorT1,
typename FunctorT2>
48 void Listen(FunctorT1 on_session_opened, FunctorT2 on_session_closed) {
52 std::move(on_session_opened),
53 std::move(on_session_closed));
std::atomic< time_duration > _timeout
boost::asio::io_context & _io_context
boost::asio::ip::tcp::endpoint endpoint
This file contains definitions of common data structures used in traffic manager. ...
void SetTimeout(time_duration timeout)
Set session time-out.
std::function< void(std::shared_ptr< ServerSession >)> callback_function_type
bool IsSynchronousMode() const
void SetSynchronousMode(bool is_synchro)
endpoint GetLocalEndpoint() const
void Listen(FunctorT1 on_session_opened, FunctorT2 on_session_closed)
Start listening for connections.
Positive time duration up to milliseconds resolution.
Server(boost::asio::io_context &io_context, endpoint ep)
Inherit (privately) to suppress copy/move construction and assignment.
void OpenSession(time_duration timeout, ServerSession::callback_function_type on_session_opened, ServerSession::callback_function_type on_session_closed)
endpoint::protocol_type protocol_type
boost::asio::ip::tcp::acceptor _acceptor