Skip to content

Instantly share code, notes, and snippets.

@AlexandreGerault
Last active June 21, 2020 15:38
Show Gist options
  • Save AlexandreGerault/85213989a8353feebe7bbf16ee69d6f2 to your computer and use it in GitHub Desktop.
Save AlexandreGerault/85213989a8353feebe7bbf16ee69d6f2 to your computer and use it in GitHub Desktop.
error using factory with servers
#include "core/application.hpp"
using namespace ww;
application::application(boost::asio::io_context &context, boost::asio::ip::tcp::endpoint const &endpoint)
: m_config("general.config") {
spdlog::debug("Application created");
init_server_factory();
try {
create_server("tcp_server", context, endpoint);
create_server("tcp_ws_server", context, endpoint);
} catch (boost::system::system_error &ec) {
spdlog::error("Cannot create application: {}", ec.what());
}
}
void application::init_server_factory() {
m_server_factory.registers(
"tcp_server",
[](boost::asio::io_context &context, boost::asio::ip::tcp::endpoint const &endpoint)
-> std::unique_ptr<tcp_server_interface> {
return std::make_unique<tcp_server>(context, endpoint);
});
m_server_factory.registers(
"tcp_ws_server",
[](boost::asio::io_context &context, boost::asio::ip::tcp::endpoint const &endpoint)
-> std::unique_ptr<tcp_server_interface> {
return std::make_unique<tcp_server>(context, endpoint);
});
}
#ifndef WEREWOLF_APPLICATION_HPP
#define WEREWOLF_APPLICATION_HPP
#include <boost/asio/io_context.hpp>
#include <string>
#include <spdlog/spdlog.h>
#include "core/configuration.hpp"
#include "network/tcp_server_interface.hpp"
#include "network/tcp_server.hpp"
#include "network/tcp_ws_server.hpp"
#include "rooms/server_rooms.hpp"
#include "utils/factory.hpp"
namespace ww {
class application {
public:
application(boost::asio::io_context &io_context, boost::asio::ip::tcp::endpoint const &endpoint);
template<class... Args>
void create_server(std::string const &type, Args &&... args) {
auto server = m_server_factory.make(type, args...);
m_servers.insert(std::move(server));
}
private:
void init_server_factory();
configuration m_config;
factory<tcp_server_interface, boost::asio::io_context, boost::asio::ip::tcp::endpoint> m_server_factory;
std::unordered_set<std::unique_ptr<tcp_server_interface>> m_servers;
server_rooms m_rooms;
};
}
#endif //WEREWOLF_APPLICATION_HPP
====================[ Build | server | Debug ]==================================
/usr/bin/cmake --build "/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/cmake-build-debug" --target server -- -j 8
Scanning dependencies of target server_lib
[ 7%] Building CXX object CMakeFiles/server_lib.dir/src/core/application.cpp.o
Dans le fichier inclus depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/bind.hpp:30,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/network/tcp_connection.hpp:6,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/network/tcp_server.hpp:5,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/core/application.hpp:10,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:1:
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/config/pragma_message.hpp:24:34: note: « #pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior. »
24 | # define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
| ^~~~~~~
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/config/pragma_message.hpp:24:34: note: dans la définition de la macro « BOOST_PRAGMA_MESSAGE »
24 | # define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
| ^~~~~~~
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp: Dans la fonction membre « void ww::application::init_server_factory() »:
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:24:14: erreur: ne peut convertir « ww::application::init_server_factory()::<lambda(boost::asio::io_context&, const endpoint&)> » en « const Creator& » {aka « const std::function<std::unique_ptr<ww::tcp_server_interface, std::default_delete<ww::tcp_server_interface> >(boost::asio::io_context, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>)>& »}
24 | });
| ^
Dans le fichier inclus depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/rooms/server_rooms.hpp:7,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/core/application.hpp:12,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:1:
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/utils/factory.hpp:26:63: note: initialisation de l'argument 2 de « void ww::factory<Object, Args>::registers(const string&, const Creator&) [with Object = ww::tcp_server_interface; Args = {boost::asio::io_context, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>}; std::string = std::__cxx11::basic_string<char>; ww::factory<Object, Args>::Creator = std::function<std::unique_ptr<ww::tcp_server_interface, std::default_delete<ww::tcp_server_interface> >(boost::asio::io_context, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>)>] »
26 | void registers(std::string const &key, Creator const &creator) {
| ~~~~~~~~~~~~~~~^~~~~~~
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:31:14: erreur: ne peut convertir « ww::application::init_server_factory()::<lambda(boost::asio::io_context&, const endpoint&)> » en « const Creator& » {aka « const std::function<std::unique_ptr<ww::tcp_server_interface, std::default_delete<ww::tcp_server_interface> >(boost::asio::io_context, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>)>& »}
31 | });
| ^
Dans le fichier inclus depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/rooms/server_rooms.hpp:7,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/core/application.hpp:12,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:1:
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/utils/factory.hpp:26:63: note: initialisation de l'argument 2 de « void ww::factory<Object, Args>::registers(const string&, const Creator&) [with Object = ww::tcp_server_interface; Args = {boost::asio::io_context, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>}; std::string = std::__cxx11::basic_string<char>; ww::factory<Object, Args>::Creator = std::function<std::unique_ptr<ww::tcp_server_interface, std::default_delete<ww::tcp_server_interface> >(boost::asio::io_context, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>)>] »
26 | void registers(std::string const &key, Creator const &creator) {
| ~~~~~~~~~~~~~~~^~~~~~~
Dans le fichier inclus depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:1:
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/core/application.hpp: Dans l'instanciation de « void ww::application::create_server(const string&, Args&& ...) [with Args = {boost::asio::io_context&, const boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>&}; std::string = std::__cxx11::basic_string<char>] » :
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:11:54: requis depuis ici
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/core/application.hpp:22:48: erreur: impossible de lier la référence d'une r-valeur de type « boost::asio::io_context&& » à une l-valeur de type « boost::asio::io_context »
22 | auto server = m_server_factory.make(type, args...);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Dans le fichier inclus depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/rooms/server_rooms.hpp:7,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/core/application.hpp:12,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:1:
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/utils/factory.hpp:38:69: note: initialisation de l'argument 2 de « std::unique_ptr<_Tp> ww::factory<Object, Args>::make(const string&, Args&& ...) const [with Object = ww::tcp_server_interface; Args = {boost::asio::io_context, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>}; std::string = std::__cxx11::basic_string<char>] »
38 | std::unique_ptr<Object> make(std::string const &key, Args &&... args) const {
| ~~~~~~~^~~~~~~~
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/utils/factory.hpp: Dans l'instanciation de « std::unique_ptr<_Tp> ww::factory<Object, Args>::make(const string&, Args&& ...) const [with Object = ww::tcp_server_interface; Args = {boost::asio::io_context, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>}; std::string = std::__cxx11::basic_string<char>] » :
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/core/application.hpp:22:44: requis par « void ww::application::create_server(const string&, Args&& ...) [with Args = {boost::asio::io_context&, const boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>&}; std::string = std::__cxx11::basic_string<char>] »
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:11:54: requis depuis ici
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/utils/factory.hpp:41:21: erreur: utilisation de la fonction supprimée « boost::asio::io_context::io_context(const boost::asio::io_context&) »
41 | return r(std::forward<Args>(args)...);
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dans le fichier inclus depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/core/application.hpp:4,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:1:
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/io_context.hpp:179:7: note: « boost::asio::io_context::io_context(const boost::asio::io_context&) » est implicitement supprimé car la définition par défaut serait mal formée:
179 | class io_context
| ^~~~~~~~~~
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/io_context.hpp:179:7: erreur: utilisation de la fonction supprimée « boost::asio::execution_context::execution_context(const boost::asio::execution_context&) »
Dans le fichier inclus depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/detail/scheduler.hpp:21,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/system_context.hpp:19,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/impl/system_executor.hpp:22,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/system_executor.hpp:129,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/associated_executor.hpp:21,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/detail/bind_handler.hpp:20,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/detail/wrapped_handler.hpp:18,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/io_context.hpp:24,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/core/application.hpp:4,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:1:
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/execution_context.hpp:106:7: note: « boost::asio::execution_context::execution_context(const boost::asio::execution_context&) » est implicitement supprimé car la définition par défaut serait mal formée:
106 | class execution_context
| ^~~~~~~~~~~~~~~~~
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/execution_context.hpp:106:7: erreur: « boost::asio::detail::noncopyable::noncopyable(const boost::asio::detail::noncopyable&) » est privé dans ce contexte
Dans le fichier inclus depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/io_context.hpp:23,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/core/application.hpp:4,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:1:
/run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/detail/noncopyable.hpp:32:3: note: déclaré privé ici
32 | noncopyable(const noncopyable&);
| ^~~~~~~~~~~
Dans le fichier inclus depuis /usr/include/c++/10.1.0/functional:59,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/system/error_code.hpp:19,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/detail/scheduler_operation.hpp:18,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/detail/executor_op.hpp:22,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/impl/system_executor.hpp:18,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/system_executor.hpp:129,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/associated_executor.hpp:21,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/detail/bind_handler.hpp:20,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/detail/wrapped_handler.hpp:18,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/libs/boost_1_73_0_arch_linux/include/boost/asio/io_context.hpp:24,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/include/core/application.hpp:4,
depuis /run/media/alexandre-gerault/Seagate Expansion Drive/Programming/C++/werewolf/server_lib/src/core/application.cpp:1:
/usr/include/c++/10.1.0/bits/std_function.h:618:25: note: initialisation de l'argument 1 de « _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = std::unique_ptr<ww::tcp_server_interface, std::default_delete<ww::tcp_server_interface> >; _ArgTypes = {boost::asio::io_context, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>}] »
618 | operator()(_ArgTypes... __args) const
| ~~~~~~~~~^~~~~~~~~~
make[3]: *** [CMakeFiles/server_lib.dir/build.make:174 : CMakeFiles/server_lib.dir/src/core/application.cpp.o] Erreur 1
make[2]: *** [CMakeFiles/Makefile2:125 : CMakeFiles/server_lib.dir/all] Erreur 2
make[1]: *** [CMakeFiles/Makefile2:105 : CMakeFiles/server.dir/rule] Erreur 2
make: *** [Makefile:138 : server] Erreur 2
#ifndef WEREWOLF_ROOM_FACTORY_HPP
#define WEREWOLF_ROOM_FACTORY_HPP
#include <functional>
#include <memory>
#include <string>
#include <unordered_map>
namespace ww {
template<class Object, class... Args>
class factory {
public:
/**
* Just an alias to avoid repeating long type
*/
using Creator = std::function<std::unique_ptr<Object>(Args...)>;
/**
* Register a new creatable class from a specialized class of <Object>.
*
* @param key
* @param creator Function that handle the creation of the object
*/
void registers(std::string const &key, Creator const &creator) {
m_registry.emplace(key, creator);
}
/**
* Find the creation function from the map if key exists.
* Then call the creation function with given arguments (if they are arguments)
*
* @param key
* @param args
* @return
*/
std::unique_ptr<Object> make(std::string const &key, Args &&... args) const {
auto it = m_registry.find(key);
auto&& r = it->second;
return r(std::forward<Args>(args)...);
}
private:
std::unordered_map<std::string, Creator> m_registry;
};
}// namespace ww
#endif//WEREWOLF_ROOM_FACTORY_HPP
#include "network/tcp_server.hpp"
#include <iostream>
using namespace ww;
tcp_server::tcp_server(boost::asio::io_context &io_context, boost::asio::ip::tcp::endpoint const &endpoint)
: tcp_server_interface{io_context, endpoint} {
spdlog::debug("TCP server created");
}
/**
* @brief start the server events loop.
*/
void tcp_server::run() {
spdlog::debug("Run server");
start_accept();
m_io_context.run();
}
/**
* @brief we start to listen for a new connection.
*/
void tcp_server::start_accept() {
spdlog::debug("Start listening for incoming TCP connection...");
session_ptr new_connection = std::make_shared<tcp_connection>(m_io_context);
spdlog::debug("New connection pointer created.");
m_acceptor.async_accept(
new_connection->socket(),
boost::bind(&tcp_server::handle_accept, this, new_connection, boost::asio::placeholders::error)
);
}
/**
* @brief add the new connection to the set then listen for a new connection again (to avoid the server to stop).
*
* @param new_connection
* @param error
*/
void tcp_server::handle_accept(session_ptr new_connection, const boost::system::error_code &error) {
if (!error) {
spdlog::info("New connection!");
m_clients.insert(new_connection);
new_connection->start();
start_accept();
}
}
#ifndef WEREWOLFSERVER_TCP_SERVER_HPP
#define WEREWOLFSERVER_TCP_SERVER_HPP
#include "network/tcp_server_interface.hpp"
#include "network/tcp_connection.hpp"
namespace ww {
class tcp_server : public tcp_server_interface {
public:
tcp_server() = delete;
tcp_server(boost::asio::io_context &io_context, boost::asio::ip::tcp::endpoint const &endpoint);
void run() override ;
private:
void start_accept() override ;
void handle_accept(session_ptr new_connection, const boost::system::error_code &error) override ;
};
} // namespace ww
#endif//WEREWOLFSERVER_TCP_SERVER_HPP
#include "network/tcp_server_interface.hpp"
using namespace ww;
tcp_server_interface::tcp_server_interface(boost::asio::io_context &io_context,
const boost::asio::ip::tcp::endpoint &endpoint
) : m_io_context(io_context),
m_acceptor(io_context, endpoint) {
spdlog::debug("TCP server interface constructor");
}
#ifndef WEREWOLFSERVER_TCP_SERVER_INTERFACE_HPP
#define WEREWOLFSERVER_TCP_SERVER_INTERFACE_HPP
#include <boost/asio.hpp>
#include <unordered_set>
#include <memory>
#include <spdlog/spdlog.h>
#include "network/tcp_connection_interface.hpp"
namespace ww {
typedef std::shared_ptr<tcp_connection_interface> session_ptr;
class tcp_server_interface {
public:
tcp_server_interface() = delete;
tcp_server_interface(boost::asio::io_context &io_context, boost::asio::ip::tcp::endpoint const &endpoint);
virtual void run() = 0;
protected:
boost::asio::io_context &m_io_context;
boost::asio::ip::tcp::acceptor m_acceptor;
std::unordered_set<session_ptr> m_clients;
virtual void start_accept() = 0;
virtual void handle_accept(session_ptr new_connection, const boost::system::error_code &error) = 0;
};
} //namespace ww
#endif //WEREWOLFSERVER_TCP_SERVER_INTERFACE_HPP
#include "network/tcp_ws_server.hpp"
using namespace ww;
tcp_ws_server::tcp_ws_server(boost::asio::io_context &io_context, const boost::asio::ip::tcp::endpoint &endpoint)
: tcp_server_interface{io_context, endpoint} {
spdlog::debug("Websocket server created");
}
void tcp_ws_server::run() {
}
void tcp_ws_server::start_accept() {
}
void tcp_ws_server::handle_accept(session_ptr new_connection, const boost::system::error_code &error) {
}
#ifndef WEREWOLFSERVER_TCP_WS_SERVER_HPP
#define WEREWOLFSERVER_TCP_WS_SERVER_HPP
#include "network/tcp_server_interface.hpp"
namespace ww {
class tcp_ws_server : public tcp_server_interface {
public:
tcp_ws_server() = delete;
tcp_ws_server(boost::asio::io_context &io_context, boost::asio::ip::tcp::endpoint const &endpoint);
void run() override ;
private:
void start_accept() override ;
void handle_accept(session_ptr new_connection, const boost::system::error_code &error) override ;
};
}
#endif //WEREWOLFSERVER_TCP_WS_SERVER_HPP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment