cluster: Populate broadcast_topics during zeek_init()

The topics themselves are redef'able now, but broadcast_topics would
contain the original values.
This commit is contained in:
Arne Welzel 2025-03-13 13:38:42 +01:00
parent 2a5b5bd7d7
commit 8bd7bd0923

View file

@ -56,12 +56,10 @@ export {
## relevant to all nodes in a cluster. Currently, there is not a common
## topic to broadcast to, because enabling implicit Broker forwarding would
## cause a routing loop for this topic.
const broadcast_topics = {
logger_topic,
manager_topic,
proxy_topic,
worker_topic,
};
##
## Note that with :zeek:see:`Cluster::enable_global_pub_sub` and non-Broker
## backends a single broadcast topic has become an option.
const broadcast_topics: set[string] = set() &ordered;
## The topic prefix used for exchanging messages that are relevant to
## a named node in a cluster. Used with broker-enabled cluster communication.
@ -552,6 +550,13 @@ event node_down(name: string, id: string) &priority=10
name, id));
}
event zeek_init() &priority=1000
{
# Populate broadcast_topics based on redef'ble consts.
for ( _, topic in vector(manager_topic, logger_topic, worker_topic, proxy_topic) )
add broadcast_topics[topic];
}
event zeek_init() &priority=5
{
# If a node is given, but it's an unknown name we need to fail.