This commit is contained in:
Nathan Nichols
2021-06-14 09:38:27 -05:00
committed by CJ Cobb
parent 3389a892b3
commit f058e6b79d
11 changed files with 475 additions and 45 deletions

View File

@@ -30,8 +30,15 @@
#include <functional>
#include <iostream>
#include <memory>
<<<<<<< HEAD:server/websocket_server_async.cpp
#include <server/listener.h>
#include <server/session.h>
=======
#include <reporting/ReportingETL.h>
#include <reporting/server/listener.h>
#include <reporting/server/WsSession.h>
#include <reporting/server/HttpSession.h>
>>>>>>> 27506bc (rebase handlers):websocket_server_async.cpp
#include <sstream>
#include <string>
#include <thread>
@@ -99,12 +106,45 @@ initLogLevel(int level)
void
start(boost::asio::io_context& ioc, std::uint32_t numThreads)
{
<<<<<<< HEAD:server/websocket_server_async.cpp
std::vector<std::thread> v;
v.reserve(numThreads - 1);
for (auto i = numThreads - 1; i > 0; --i)
v.emplace_back([&ioc] { ioc.run(); });
ioc.run();
=======
auto const address =
boost::asio::ip::make_address(wsConfig.at("ip").as_string().c_str());
auto const port =
static_cast<unsigned short>(wsConfig.at("port").as_uint64());
// Create and launch a listening port
std::make_shared<listener<WsSession>>(
ioc,
boost::asio::ip::tcp::endpoint{address, port},
etl)
->run();
}
void
openHttpServer(
boost::json::object const& httpConfig,
boost::asio::io_context& ioc,
ReportingETL& etl)
{
auto const address =
boost::asio::ip::make_address(httpConfig.at("ip").as_string().c_str());
auto const port =
static_cast<unsigned short>(httpConfig.at("port").as_uint64());
// Create and launch a listening port
std::make_shared<listener<HttpSession>>(
ioc,
boost::asio::ip::tcp::endpoint{address, port},
etl)
->run();
>>>>>>> 27506bc (rebase handlers):websocket_server_async.cpp
}
int