16 #if defined(__clang__) 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> 24 #if defined(__clang__) 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());
callback_function_type _on_closed
void CloseNow(boost::system::error_code ec=boost::system::error_code())
This file contains definitions of common data structures used in traffic manager. ...
void Close()
Post a job to close the session.
void Write(Buffers... buffers)
Writes some data to the socket.
std::function< void(std::shared_ptr< ServerSession >)> callback_function_type
void Write(std::shared_ptr< const Message > message)
Writes some data to the socket.
stream_id_type get_stream_id() const
boost::asio::ip::tcp::socket socket_type
Positive time duration up to milliseconds resolution.
Inherit (privately) to suppress copy/move construction and assignment.
boost::asio::deadline_timer _deadline
stream_id_type _stream_id
static auto MakeMessage(Buffers... buffers)
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...
ServerSession(boost::asio::io_context &io_context, time_duration timeout, Server &server)
boost::asio::io_context::strand _strand