aboutsummaryrefslogtreecommitdiff
path: root/network-handler/networkhandler.hpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-08-29 13:29:30 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-08-29 13:29:30 +0200
commita736abb4e3668771f248e7400a093cb40b5313b7 (patch)
treeccd7b225f1138dc2743ee64aadc7bf11635c9bc9 /network-handler/networkhandler.hpp
parent00ab2cf6add2976b3a4e8f8cc488777ad5c27808 (diff)
downloadcmix-a736abb4e3668771f248e7400a093cb40b5313b7.tar.gz
cmix-a736abb4e3668771f248e7400a093cb40b5313b7.tar.bz2
cmix-a736abb4e3668771f248e7400a093cb40b5313b7.zip
Adds the Acceptor and Client class.
The acceptor combines the endpoint and acceptor to reduce clutter in NetworkHandler class. The client will handle the connection for the network handler for every separate client. The networkhander now has a std::list of Client, to keep track and ownership of all the Clients.
Diffstat (limited to 'network-handler/networkhandler.hpp')
-rw-r--r--network-handler/networkhandler.hpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/network-handler/networkhandler.hpp b/network-handler/networkhandler.hpp
index d0eab6f..c4930ca 100644
--- a/network-handler/networkhandler.hpp
+++ b/network-handler/networkhandler.hpp
@@ -1,7 +1,10 @@
#pragma once
+#include "acceptor.hpp"
+#include "client.hpp"
+
#include <boost/asio/io_service.hpp>
-#include <boost/asio.hpp>
+#include <boost/asio/streambuf.hpp>
#include <string>
#include <cstdint>
@@ -20,12 +23,12 @@ class NetworkHandler
ListenSettings const& listen_settings;
boost::asio::io_service io_service;
- boost::asio::ip::tcp::acceptor v4_acceptor;
- boost::asio::ip::tcp::acceptor v6_acceptor;
- boost::asio::ip::tcp::endpoint v4_endpoint;
- boost::asio::ip::tcp::endpoint v6_endpoint;
-
- std::list<boost::asio::ip::tcp::socket> accepted_connections;
+ Acceptor v4_acceptor;
+ Acceptor v6_acceptor;
+
+ boost::asio::streambuf stdin_buffer;
+
+ std::list<Client> clients;
public:
NetworkHandler(ListenSettings const& listen_settings);