mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
scripts/base/cluster: Move active node management into node_down()
With the idea of an alternative cluster backend, we should not maintain Cluster state within low-level Broker events.
This commit is contained in:
parent
78999d147d
commit
6bb7b9d726
1 changed files with 20 additions and 4 deletions
|
@ -401,16 +401,32 @@ event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string) &priority=1
|
|||
{
|
||||
if ( n?$id && n$id == endpoint$id )
|
||||
{
|
||||
Cluster::log(fmt("node down: %s", node_name));
|
||||
delete n$id;
|
||||
delete active_node_ids[n$node_type][endpoint$id];
|
||||
|
||||
event Cluster::node_down(node_name, endpoint$id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event node_down(name: string, id: string) &priority=10
|
||||
{
|
||||
local found = F;
|
||||
for ( node_name, n in nodes )
|
||||
{
|
||||
if ( n?$id && n$id == id )
|
||||
{
|
||||
Cluster::log(fmt("node down: %s", node_name));
|
||||
delete n$id;
|
||||
delete active_node_ids[n$node_type][id];
|
||||
found = T;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! found )
|
||||
Reporter::error(fmt("No node found in Cluster::node_down() node:%s id:%s",
|
||||
name, id));
|
||||
}
|
||||
|
||||
event zeek_init() &priority=5
|
||||
{
|
||||
# If a node is given, but it's an unknown name we need to fail.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue