17# pragma clang diagnostic push
18# pragma clang diagnostic ignored "-Wshadow"
20#include <boost/asio/deadline_timer.hpp>
21#include <boost/asio/io_context.hpp>
22#include <boost/asio/ip/tcp.hpp>
23#include <boost/asio/strand.hpp>
25# pragma clang diagnostic pop
42 :
public std::enable_shared_from_this<ServerSession>,
51 boost::asio::io_context &io_context,
67 template <
typename... Buffers>
71 "This function only accepts arguments of type BufferView.");
72 return std::make_shared<const Message>(buffers...);
76 void Write(std::shared_ptr<const Message> message);
79 template <
typename... Buffers>
80 void Write(Buffers... buffers) {
91 void CloseNow(boost::system::error_code ec = boost::system::error_code());
Inherit (privately) to suppress copy/move construction and assignment.
stream_id_type get_stream_id() const
boost::asio::deadline_timer _deadline
void CloseNow(boost::system::error_code ec=boost::system::error_code())
void Close()
Post a job to close the session.
boost::asio::ip::tcp::socket socket_type
ServerSession(boost::asio::io_context &io_context, time_duration timeout, Server &server)
void Open(callback_function_type on_opened, callback_function_type on_closed)
Starts the session and calls on_opened after successfully reading the stream id, and on_closed once t...
callback_function_type _on_closed
boost::asio::io_context::strand _strand
stream_id_type _stream_id
static auto MakeMessage(Buffers... buffers)
std::function< void(std::shared_ptr< ServerSession >)> callback_function_type
void Write(Buffers... buffers)
Writes some data to the socket.
void Write(std::shared_ptr< const Message > message)
Writes some data to the socket.
Positive time duration up to milliseconds resolution.
This file contains definitions of common data structures used in traffic manager.
std::shared_ptr< BufferView > SharedBufferView