Commit 7e2fcfa1 authored by Dominik Charousset's avatar Dominik Charousset

Fix remote_lookup, relates #473

parent 66bc4c93
......@@ -515,17 +515,17 @@ behavior basp_broker::make_behavior() {
<< ", " << CAF_ARG(msg));
if (! src)
return sec::cannot_forward_to_invalid_actor;
auto path = this->state.instance.tbl().lookup(dest_node);
if (! path) {
CAF_LOG_ERROR("no route to receiving node");
return sec::no_route_to_receiving_node;
}
if (system().node() == src->node())
system().registry().put(src->id(), src);
auto writer = make_callback([&](serializer& sink) {
std::vector<actor_addr> stages;
sink << dest_name << stages << msg;
});
auto path = this->state.instance.tbl().lookup(dest_node);
if (! path) {
CAF_LOG_ERROR("no route to receiving node");
return sec::no_route_to_receiving_node;
}
basp::header hdr{basp::message_type::dispatch_message,
basp::header::named_receiver_flag,
0, 0, state.this_node(), dest_node,
......
......@@ -246,11 +246,14 @@ group middleman::remote_group(const std::string& group_identifier,
strong_actor_ptr middleman::remote_lookup(atom_value name, const node_id& nid) {
CAF_LOG_TRACE(CAF_ARG(name) << CAF_ARG(nid));
if (system().node() == nid)
return system().registry().get(name);
auto basp = named_broker<basp_broker>(atom("BASP"));
strong_actor_ptr result;
scoped_actor self{system(), true};
try {
self->send(basp, forward_atom::value, self.address(), nid, name,
self->send(basp, forward_atom::value, actor_cast<strong_actor_ptr>(self),
nid, name,
make_message(sys_atom::value, get_atom::value, "info"));
self->receive(
[&](ok_atom, std::string&, strong_actor_ptr& addr, std::string&) {
......@@ -260,7 +263,7 @@ strong_actor_ptr middleman::remote_lookup(atom_value name, const node_id& nid) {
// nop
}
);
} catch (...) {
} catch (std::exception& e) {
// nop
}
return result;
......
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