From 00863566ec4601c65c435b74e575d49546a1c707 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 7 Dec 2019 03:36:21 +0300 Subject: split server into multiple components In a vague attempt to make header files more readable, split server/ into a number of components. Also, refactor the unit tests to use the "Data-driven test cases" of Boost.Test. --- server/session.hpp | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 server/session.hpp (limited to 'server/session.hpp') diff --git a/server/session.hpp b/server/session.hpp deleted file mode 100644 index ace3755..0000000 --- a/server/session.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include -#include - -namespace math::server { - -class SessionManager; - -class Session : public std::enable_shared_from_this { -public: - Session(SessionManager& mgr, boost::asio::io_context& io_context); - - boost::asio::ip::tcp::socket& socket(); - - void start(); - void stop(); - -private: - void close(); - - void read(); - void write(std::string); - - void handle_read(const boost::system::error_code&, std::size_t); - void handle_write(const boost::system::error_code&, std::size_t); - - std::string consume_input(std::size_t); - - SessionManager& m_session_mgr; - - boost::asio::io_context::strand m_strand; - boost::asio::ip::tcp::socket m_socket; - boost::asio::streambuf m_buffer; -}; - -} -- cgit v1.2.3