Commit 3c2305e9 authored by Dominik Charousset's avatar Dominik Charousset

Generate exit/down message on node failure

parent dec30982
...@@ -146,9 +146,11 @@ void basp_broker_state::finalize_handshake(const node_id& nid, actor_id aid, ...@@ -146,9 +146,11 @@ void basp_broker_state::finalize_handshake(const node_id& nid, actor_id aid,
void basp_broker_state::purge_state(const node_id& nid) { void basp_broker_state::purge_state(const node_id& nid) {
CAF_LOG_TRACE(CAF_ARG(nid)); CAF_LOG_TRACE(CAF_ARG(nid));
// We can only be sure a node is down when we had a direct connection.
auto hdl = instance.tbl().lookup_direct(nid); auto hdl = instance.tbl().lookup_direct(nid);
if (hdl == invalid_connection_handle) if (hdl == invalid_connection_handle)
return; return;
// Cleanup state in case we lost connection during handshake.
auto i = ctx.find(hdl); auto i = ctx.find(hdl);
if (i != ctx.end()) { if (i != ctx.end()) {
auto& ref = i->second; auto& ref = i->second;
...@@ -158,6 +160,9 @@ void basp_broker_state::purge_state(const node_id& nid) { ...@@ -158,6 +160,9 @@ void basp_broker_state::purge_state(const node_id& nid) {
} }
ctx.erase(i); ctx.erase(i);
} }
// Destroy all proxies of the lost node.
namespace_.erase(nid);
// Close network connection.
self->close(hdl); self->close(hdl);
} }
...@@ -179,7 +184,7 @@ void basp_broker_state::proxy_announced(const node_id& nid, actor_id aid) { ...@@ -179,7 +184,7 @@ void basp_broker_state::proxy_announced(const node_id& nid, actor_id aid) {
instance.tbl().flush(*path); instance.tbl().flush(*path);
}; };
auto ptr = actor_cast<strong_actor_ptr>(entry); auto ptr = actor_cast<strong_actor_ptr>(entry);
if (!ptr) { if (ptr == nullptr) {
CAF_LOG_DEBUG("kill proxy immediately"); CAF_LOG_DEBUG("kill proxy immediately");
// kill immediately if actor has already terminated // kill immediately if actor has already terminated
send_kill_proxy_instance(exit_reason::unknown); send_kill_proxy_instance(exit_reason::unknown);
......
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