aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/main/server.cpp6
-rw-r--r--server/main/server.hpp6
-rw-r--r--server/main/settings.hpp10
3 files changed, 13 insertions, 9 deletions
diff --git a/server/main/server.cpp b/server/main/server.cpp
index 3800144..faeebf1 100644
--- a/server/main/server.cpp
+++ b/server/main/server.cpp
@@ -19,11 +19,11 @@
namespace math::server {
namespace {
-boost::asio::ip::tcp::endpoint make_endpoint(unsigned port) {
+boost::asio::ip::tcp::endpoint make_endpoint(unsigned short port) {
return {boost::asio::ip::tcp::v4(), port};
}
-void configure_acceptor(boost::asio::ip::tcp::acceptor& acceptor, unsigned port) {
+void configure_acceptor(boost::asio::ip::tcp::acceptor& acceptor, unsigned short port) {
try {
const auto endpoint = make_endpoint(port);
acceptor.open(endpoint.protocol());
@@ -41,7 +41,7 @@ Server::Server(const Settings& settings)
: Server{settings.m_port, settings.m_threads}
{ }
-Server::Server(unsigned port, unsigned threads)
+Server::Server(unsigned short port, std::size_t threads)
: m_numof_threads{threads}
, m_signals{m_io_context}
, m_acceptor{m_io_context} {
diff --git a/server/main/server.hpp b/server/main/server.hpp
index 5524f88..50d8c7a 100644
--- a/server/main/server.hpp
+++ b/server/main/server.hpp
@@ -6,12 +6,14 @@
#include <boost/asio.hpp>
#include <boost/system/error_code.hpp>
+#include <cstddef>
+
namespace math::server {
class Server {
public:
Server(const Settings& settings);
- Server(unsigned port, unsigned threads);
+ Server(unsigned short port, std::size_t threads);
void run();
@@ -22,7 +24,7 @@ private:
void accept();
void handle_accept(SessionPtr session, const boost::system::error_code& ec);
- const unsigned m_numof_threads;
+ const std::size_t m_numof_threads;
boost::asio::io_context m_io_context;
boost::asio::signal_set m_signals;
diff --git a/server/main/settings.hpp b/server/main/settings.hpp
index 310163f..5a1e375 100644
--- a/server/main/settings.hpp
+++ b/server/main/settings.hpp
@@ -3,6 +3,8 @@
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
+#include <cstddef>
+
#include <exception>
#include <iostream>
#include <string>
@@ -12,12 +14,12 @@
namespace math::server {
struct Settings {
- static constexpr unsigned DEFAULT_PORT = 18000;
+ static constexpr unsigned short DEFAULT_PORT = 18000;
- static unsigned default_threads() { return std::thread::hardware_concurrency(); }
+ static std::size_t default_threads() { return std::thread::hardware_concurrency(); }
- unsigned m_port;
- unsigned m_threads;
+ unsigned short m_port;
+ std::size_t m_threads;
bool exit_with_usage() const { return m_vm.count("help"); }