mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Add support for making the supervisor listen for requests
The supervisor now starts listening on the configured Broker default address and port when the new boolean SupervisorControl::enable_listen is T. Listening remains disabled by default. Listening allows nodes to communicate with the supervisor via the events laid out in control.zeek, to conduct further node management.
This commit is contained in:
parent
36051dc9a1
commit
efaa9ec3be
2 changed files with 12 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
||||||
##! That is, it may change in various incompatible ways without warning or
|
##! That is, it may change in various incompatible ways without warning or
|
||||||
##! deprecation until the stable 4.0.0 release.
|
##! deprecation until the stable 4.0.0 release.
|
||||||
|
|
||||||
|
@load base/frameworks/broker
|
||||||
@load ./api
|
@load ./api
|
||||||
|
|
||||||
module SupervisorControl;
|
module SupervisorControl;
|
||||||
|
@ -15,6 +16,10 @@ export {
|
||||||
## for their topic names.
|
## for their topic names.
|
||||||
const topic_prefix = "zeek/supervisor" &redef;
|
const topic_prefix = "zeek/supervisor" &redef;
|
||||||
|
|
||||||
|
## When enabled, the Supervisor will listen on the configured Broker
|
||||||
|
## :zeek:see:`Broker::default_listen_address`.
|
||||||
|
const enable_listen = F &redef;
|
||||||
|
|
||||||
## Send a request to a remote Supervisor process to create a node.
|
## Send a request to a remote Supervisor process to create a node.
|
||||||
##
|
##
|
||||||
## reqid: an arbitrary string that will be directly echoed in the response
|
## reqid: an arbitrary string that will be directly echoed in the response
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
@load ./api
|
@load ./api
|
||||||
@load ./control
|
@load ./control
|
||||||
@load base/frameworks/broker
|
|
||||||
|
|
||||||
function Supervisor::status(node: string): Supervisor::Status
|
function Supervisor::status(node: string): Supervisor::Status
|
||||||
{
|
{
|
||||||
|
@ -42,6 +41,13 @@ function Supervisor::node(): Supervisor::NodeConfig
|
||||||
|
|
||||||
event zeek_init() &priority=10
|
event zeek_init() &priority=10
|
||||||
{
|
{
|
||||||
|
if ( Supervisor::is_supervisor() && SupervisorControl::enable_listen )
|
||||||
|
{
|
||||||
|
Broker::listen(Broker::default_listen_address,
|
||||||
|
Broker::default_port,
|
||||||
|
Broker::default_listen_retry);
|
||||||
|
}
|
||||||
|
|
||||||
Broker::subscribe(SupervisorControl::topic_prefix);
|
Broker::subscribe(SupervisorControl::topic_prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue