Commit d9d2971c authored by Jakob Otto's avatar Jakob Otto

Followup

parent c0062a1a
...@@ -83,10 +83,6 @@ public: ...@@ -83,10 +83,6 @@ public:
return manager().system(); return manager().system();
} }
application_type& application() {
return dispatcher_.application();
}
transport_type& transport() { transport_type& transport() {
return *this; return *this;
} }
...@@ -147,8 +143,8 @@ public: ...@@ -147,8 +143,8 @@ public:
} }
template <class Parent> template <class Parent>
error resolve(Parent&, const uri& locator, const actor& listener) { void resolve(Parent&, const uri& locator, const actor& listener) {
return dispatcher_.resolve(*this, locator, listener); dispatcher_.resolve(*this, locator, listener);
} }
template <class Parent> template <class Parent>
......
...@@ -53,10 +53,6 @@ public: ...@@ -53,10 +53,6 @@ public:
// -- properties ------------------------------------------------------------- // -- properties -------------------------------------------------------------
application_type& application() {
return transport_.application();
}
transport_type& transport() { transport_type& transport() {
return transport_; return transport_;
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "caf/net/fwd.hpp" #include "caf/net/fwd.hpp"
#include "caf/net/packet_writer_decorator.hpp" #include "caf/net/packet_writer_decorator.hpp"
#include "caf/net/transport_worker.hpp" #include "caf/net/transport_worker.hpp"
#include "caf/send.hpp"
#include "caf/span.hpp" #include "caf/span.hpp"
#include "caf/unit.hpp" #include "caf/unit.hpp"
...@@ -71,6 +72,7 @@ public: ...@@ -71,6 +72,7 @@ public:
error handle_data(Parent& parent, span<byte> data, id_type id) { error handle_data(Parent& parent, span<byte> data, id_type id) {
if (auto worker = find_worker(id)) if (auto worker = find_worker(id))
return worker->handle_data(parent, data); return worker->handle_data(parent, data);
// TODO: Where to get node_id from here?
auto worker = add_new_worker(parent, node_id{}, id); auto worker = add_new_worker(parent, node_id{}, id);
if (worker) if (worker)
return (*worker)->handle_data(parent, data); return (*worker)->handle_data(parent, data);
...@@ -89,36 +91,31 @@ public: ...@@ -89,36 +91,31 @@ public:
worker->write_message(parent, std::move(msg)); worker->write_message(parent, std::move(msg));
return; return;
} }
// TODO: where to get id_type from here?
if (auto worker = add_new_worker(parent, nid, id_type{})) if (auto worker = add_new_worker(parent, nid, id_type{}))
(*worker)->write_message(parent, std::move(msg)); (*worker)->write_message(parent, std::move(msg));
} }
template <class Parent> template <class Parent>
error resolve(Parent& parent, const uri& locator, const actor& listener) { void resolve(Parent& parent, const uri& locator, const actor& listener) {
auto worker = find_worker(make_node_id(locator)); auto worker = find_worker(make_node_id(locator));
if (worker == nullptr) if (worker == nullptr)
return make_error(sec::runtime_error, "could not find worker"); anon_send(listener,
make_error(sec::runtime_error, "could not resolve node"));
worker->resolve(parent, locator.path(), listener); worker->resolve(parent, locator.path(), listener);
return none;
} }
template <class Parent> template <class Parent>
error new_proxy(Parent& parent, const node_id& nid, actor_id id) { void new_proxy(Parent& parent, const node_id& nid, actor_id id) {
auto worker = find_worker(nid); if (auto worker = find_worker(nid))
if (worker == nullptr) worker->new_proxy(parent, nid, id);
return make_error(sec::runtime_error, "could not find worker");
worker->new_proxy(parent, nid, id);
return none;
} }
template <class Parent> template <class Parent>
error local_actor_down(Parent& parent, const node_id& nid, actor_id id, void local_actor_down(Parent& parent, const node_id& nid, actor_id id,
error reason) { error reason) {
auto worker = find_worker(nid); if (auto worker = find_worker(nid))
if (worker == nullptr) worker->local_actor_down(parent, nid, id, std::move(reason));
return make_error(sec::runtime_error, "could not find worker");
worker->local_actor_down(parent, nid, id, std::move(reason));
return none;
} }
template <class... Ts> template <class... Ts>
...@@ -171,8 +168,7 @@ private: ...@@ -171,8 +168,7 @@ private:
return map.at(key); return map.at(key);
} }
// -- worker lookups // -- worker lookups ---------------------------------------------------------
// ---------------------------------------------------------
std::unordered_map<id_type, worker_ptr> workers_by_id_; std::unordered_map<id_type, worker_ptr> workers_by_id_;
std::unordered_map<node_id, worker_ptr> workers_by_node_; std::unordered_map<node_id, worker_ptr> workers_by_node_;
......
...@@ -70,7 +70,7 @@ struct fixture : host_fixture, test_coordinator_fixture<config> { ...@@ -70,7 +70,7 @@ struct fixture : host_fixture, test_coordinator_fixture<config> {
auto backend = dynamic_cast<backend::test*>(mm.backend("test")); auto backend = dynamic_cast<backend::test*>(mm.backend("test"));
auto mgr = backend->peer(mars); auto mgr = backend->peer(mars);
auto& dref = dynamic_cast<endpoint_manager_impl<transport_type>&>(*mgr); auto& dref = dynamic_cast<endpoint_manager_impl<transport_type>&>(*mgr);
app = &dref.application(); app = &dref.transport().application();
sock = backend->socket(mars); sock = backend->socket(mars);
} }
......
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