From 5bac5321fa5ab128cee2f0b8c549945bd6a1ccfc Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Tue, 30 Aug 2016 16:06:04 +0200 Subject: Split NetworkHandler in a server component and a to reuse Server. Also switched from an inheritance system to composition based system for the server based classes. --- network-handler/networkhandler.hpp | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'network-handler/networkhandler.hpp') diff --git a/network-handler/networkhandler.hpp b/network-handler/networkhandler.hpp index 058f6a9..dfa31f1 100644 --- a/network-handler/networkhandler.hpp +++ b/network-handler/networkhandler.hpp @@ -1,35 +1,22 @@ #pragma once -#include "acceptor.hpp" +#include "server.hpp" #include "userclient.hpp" #include -#include -#include -#include #include -struct ListenSettings { - bool enable_ipv4; - std::string ipv4_inaddr; - bool enable_ipv6; - std::string ipv6_inaddr; - uint16_t port; -}; - class NetworkHandler { - ListenSettings const& listen_settings; - boost::asio::io_service io_service; - Acceptor v4_acceptor; - Acceptor v6_acceptor; - + Server server; std::list clients; + void accept_handler(boost::asio::ip::tcp::socket&& socket); + public: NetworkHandler(ListenSettings const& listen_settings); - + void run(); }; -- cgit v1.2.3-70-g09d2