Commit 421aa67f authored by Jakob Otto's avatar Jakob Otto

Cleanup dispatcher and worker

parent c84b6b6c
......@@ -22,6 +22,7 @@
#include <vector>
#include "caf/fwd.hpp"
#include "caf/ip_endpoint.hpp"
#include "caf/logger.hpp"
#include "caf/net/endpoint_manager.hpp"
#include "caf/net/fwd.hpp"
......
......@@ -18,16 +18,12 @@
#pragma once
#include "caf/byte.hpp"
#include "caf/ip_endpoint.hpp"
#include "caf/net/endpoint_manager.hpp"
#include "caf/net/endpoint_manager_queue.hpp"
#include "caf/net/fwd.hpp"
#include "caf/net/packet_writer_decorator.hpp"
#include "caf/span.hpp"
#include "caf/unit.hpp"
namespace caf {
namespace net {
namespace caf::net {
/// Implements a worker for transport protocols.
template <class Application, class IdType>
......@@ -41,7 +37,8 @@ public:
// -- constructors, destructors, and assignment operators --------------------
transport_worker(application_type application, id_type id = id_type{})
explicit transport_worker(application_type application,
id_type id = id_type{})
: application_(std::move(application)), id_(std::move(id)) {
// nop
}
......@@ -119,5 +116,4 @@ template <class Application, class IdType = unit_t>
using transport_worker_ptr = std::shared_ptr<
transport_worker<Application, IdType>>;
} // namespace net
} // namespace caf
} // namespace caf::net
......@@ -18,19 +18,15 @@
#pragma once
#include <caf/logger.hpp>
#include <caf/sec.hpp>
#include <unordered_map>
#include "caf/byte.hpp"
#include "caf/ip_endpoint.hpp"
#include "caf/net/endpoint_manager.hpp"
#include "caf/logger.hpp"
#include "caf/net/endpoint_manager_queue.hpp"
#include "caf/net/fwd.hpp"
#include "caf/net/packet_writer_decorator.hpp"
#include "caf/net/transport_worker.hpp"
#include "caf/sec.hpp"
#include "caf/send.hpp"
#include "caf/span.hpp"
#include "caf/unit.hpp"
namespace caf::net {
......@@ -52,7 +48,7 @@ public:
// -- constructors, destructors, and assignment operators --------------------
transport_worker_dispatcher(factory_type factory)
explicit transport_worker_dispatcher(factory_type factory)
: factory_(std::move(factory)) {
// nop
}
......@@ -138,6 +134,7 @@ public:
template <class Parent>
expected<worker_ptr> add_new_worker(Parent& parent, node_id node,
id_type id) {
CAF_LOG_TRACE(CAF_ARG(node) << CAF_ARG(id));
auto application = factory_.make();
auto worker = std::make_shared<worker_type>(std::move(application), id);
if (auto err = worker->init(parent))
......
......@@ -25,9 +25,9 @@
#include "caf/byte.hpp"
#include "caf/detail/scope_guard.hpp"
#include "caf/ip_endpoint.hpp"
#include "caf/make_actor.hpp"
#include "caf/net/actor_proxy_impl.hpp"
#include "caf/net/endpoint_manager.hpp"
#include "caf/net/multiplexer.hpp"
#include "caf/serializer_impl.hpp"
#include "caf/span.hpp"
......
......@@ -23,6 +23,7 @@
#include "caf/net/test/host_fixture.hpp"
#include "caf/test/dsl.hpp"
#include "caf/ip_endpoint.hpp"
#include "caf/make_actor.hpp"
#include "caf/monitorable_actor.hpp"
#include "caf/node_id.hpp"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment