aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/server/main
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2019-12-07 03:36:21 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2019-12-07 03:36:21 +0300
commit00863566ec4601c65c435b74e575d49546a1c707 (patch)
tree479a0a6e96aba8191c7a65ea9bee2f4d5e3a4aba /server/main
parentadd stress_test.py (diff)
downloadmath-server-00863566ec4601c65c435b74e575d49546a1c707.tar.gz
math-server-00863566ec4601c65c435b74e575d49546a1c707.zip
split server into multiple components
In a vague attempt to make header files more readable, split server/ into a number of components. Also, refactor the unit tests to use the "Data-driven test cases" of Boost.Test.
Diffstat (limited to '')
-rw-r--r--server/main/CMakeLists.txt13
-rw-r--r--server/main/main.cpp (renamed from server/main.cpp)0
-rw-r--r--server/main/server.cpp (renamed from server/server.cpp)5
-rw-r--r--server/main/server.hpp (renamed from server/server.hpp)0
-rw-r--r--server/main/session.cpp (renamed from server/session.cpp)7
-rw-r--r--server/main/session.hpp (renamed from server/session.hpp)0
-rw-r--r--server/main/session_manager.cpp (renamed from server/session_manager.cpp)3
-rw-r--r--server/main/session_manager.hpp (renamed from server/session_manager.hpp)0
-rw-r--r--server/main/settings.hpp (renamed from server/settings.hpp)0
9 files changed, 22 insertions, 6 deletions
diff --git a/server/main/CMakeLists.txt b/server/main/CMakeLists.txt
new file mode 100644
index 0000000..b322390
--- /dev/null
+++ b/server/main/CMakeLists.txt
@@ -0,0 +1,13 @@
+find_package(Boost REQUIRED COMPONENTS filesystem program_options)
+
+option(DEBUG_ASIO "enable debug output for Boost.Asio" OFF)
+
+add_executable(server main.cpp server.cpp session.cpp session_manager.cpp)
+target_link_libraries(server PRIVATE common parser)
+
+target_include_directories(server SYSTEM PRIVATE ${Boost_INCLUDE_DIRS})
+target_link_libraries(server PRIVATE ${Boost_LIBRARIES})
+
+if(DEBUG_ASIO)
+ target_compile_definitions(server PRIVATE BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+endif()
diff --git a/server/main.cpp b/server/main/main.cpp
index 2cf6d35..2cf6d35 100644
--- a/server/main.cpp
+++ b/server/main/main.cpp
diff --git a/server/server.cpp b/server/main/server.cpp
index 4dc672c..3800144 100644
--- a/server/server.cpp
+++ b/server/main/server.cpp
@@ -1,10 +1,11 @@
-#include "error.hpp"
-#include "log.hpp"
#include "server.hpp"
#include "session.hpp"
#include "session_manager.hpp"
#include "settings.hpp"
+#include "../common/error.hpp"
+#include "../common/log.hpp"
+
#include <boost/asio.hpp>
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
diff --git a/server/server.hpp b/server/main/server.hpp
index 5524f88..5524f88 100644
--- a/server/server.hpp
+++ b/server/main/server.hpp
diff --git a/server/session.cpp b/server/main/session.cpp
index 409ca5a..0ee7f75 100644
--- a/server/session.cpp
+++ b/server/main/session.cpp
@@ -1,9 +1,10 @@
-#include "error.hpp"
-#include "log.hpp"
-#include "parser.hpp"
#include "session.hpp"
#include "session_manager.hpp"
+#include "../common/error.hpp"
+#include "../common/log.hpp"
+#include "../parser/parser.hpp"
+
#include <boost/asio.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/system/error_code.hpp>
diff --git a/server/session.hpp b/server/main/session.hpp
index ace3755..ace3755 100644
--- a/server/session.hpp
+++ b/server/main/session.hpp
diff --git a/server/session_manager.cpp b/server/main/session_manager.cpp
index a42fca4..c2aef6d 100644
--- a/server/session_manager.cpp
+++ b/server/main/session_manager.cpp
@@ -1,7 +1,8 @@
-#include "log.hpp"
#include "session.hpp"
#include "session_manager.hpp"
+#include "../common/log.hpp"
+
#include <memory>
#include <mutex>
diff --git a/server/session_manager.hpp b/server/main/session_manager.hpp
index f0bec0b..f0bec0b 100644
--- a/server/session_manager.hpp
+++ b/server/main/session_manager.hpp
diff --git a/server/settings.hpp b/server/main/settings.hpp
index 310163f..310163f 100644
--- a/server/settings.hpp
+++ b/server/main/settings.hpp