diff --git a/src/communication/server.hpp b/src/communication/server.hpp index 012117d91..5dada284d 100644 --- a/src/communication/server.hpp +++ b/src/communication/server.hpp @@ -30,14 +30,12 @@ namespace communication { * @tparam Session the server can handle different Sessions, each session * represents a different protocol so the same network infrastructure * can be used for handling different protocols - * @tparam OutputStream the server has to get the output stream as a template - parameter because the output stream is templated * @tparam Socket the input/output socket that should be used * @tparam SessionData the class with objects that will be forwarded to the session */ -template +template class Server - : public io::network::EventListener> { + : public io::network::EventListener> { using Event = io::network::Epoll::Event; public: @@ -58,7 +56,7 @@ class Server workers_.reserve(n); for (size_t i = 0; i < n; ++i) { workers_.push_back( - std::make_unique>( + std::make_unique>( session_data_)); workers_.back()->Start(alive_); } @@ -110,7 +108,7 @@ class Server void OnErrorEvent(Event &event) { close(event.data.fd); } private: - std::vector::uptr> workers_; + std::vector::uptr> workers_; std::atomic alive_{true}; int idx_{0}; diff --git a/src/communication/worker.hpp b/src/communication/worker.hpp index 281395ae2..5c101368b 100644 --- a/src/communication/worker.hpp +++ b/src/communication/worker.hpp @@ -26,20 +26,18 @@ namespace communication { * @tparam Session the worker can handle different Sessions, each session * represents a different protocol so the same network infrastructure * can be used for handling different protocols - * @tparam OutputStream the worker has to get the output stream as a template - parameter because the output stream is templated * @tparam Socket the input/output socket that should be used * @tparam SessionData the class with objects that will be forwarded to the session */ -template +template class Worker - : public io::network::StreamReader, + : public io::network::StreamReader, Session> { using StreamBuffer = io::network::StreamBuffer; public: - using uptr = std::unique_ptr>; + using uptr = std::unique_ptr>; Worker(SessionData &session_data) : session_data_(session_data) {} diff --git a/src/memgraph_bolt.cpp b/src/memgraph_bolt.cpp index 93dbe36a1..622dc5cac 100644 --- a/src/memgraph_bolt.cpp +++ b/src/memgraph_bolt.cpp @@ -25,7 +25,7 @@ using result_stream_t = communication::bolt::ChunkedEncoderBuffer>>; using session_data_t = communication::bolt::SessionData; using bolt_server_t = - communication::Server; + communication::Server; DEFINE_string(interface, "0.0.0.0", "Default interface on which to listen."); DEFINE_string(port, "7687", "Default port on which to listen."); diff --git a/tests/concurrent/network_common.hpp b/tests/concurrent/network_common.hpp index 512aaf3eb..51b8eae4d 100644 --- a/tests/concurrent/network_common.hpp +++ b/tests/concurrent/network_common.hpp @@ -21,8 +21,6 @@ static constexpr const int REPLY = 10; using endpoint_t = io::network::NetworkEndpoint; using socket_t = io::network::Socket; -class TestOutputStream {}; - class TestData {}; class TestSession { @@ -64,8 +62,7 @@ class TestSession { io::network::Epoll::Event event_; }; -using test_server_t = - communication::Server; +using test_server_t = communication::Server; void server_start(void *serverptr, int num) { ((test_server_t *)serverptr)->Start(num); diff --git a/tests/concurrent/network_read_hang.cpp b/tests/concurrent/network_read_hang.cpp index 9eb2cb062..36e0c8743 100644 --- a/tests/concurrent/network_read_hang.cpp +++ b/tests/concurrent/network_read_hang.cpp @@ -23,8 +23,6 @@ static constexpr const char interface[] = "127.0.0.1"; using endpoint_t = io::network::NetworkEndpoint; using socket_t = io::network::Socket; -class TestOutputStream {}; - class TestData {}; class TestSession { @@ -51,8 +49,7 @@ class TestSession { io::network::Epoll::Event event_; }; -using test_server_t = - communication::Server; +using test_server_t = communication::Server; test_server_t *serverptr; std::atomic run{true};