mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
cluster/zeromq: Move variable lookups from DoInit() to DoInitPostScript()
This commit is contained in:
parent
540d9da5ef
commit
ba7b605a97
3 changed files with 10 additions and 7 deletions
|
@ -134,12 +134,12 @@ export {
|
||||||
## Do not silently drop messages if high-water-mark is reached.
|
## Do not silently drop messages if high-water-mark is reached.
|
||||||
##
|
##
|
||||||
## Whether to configure ``ZMQ_XPUB_NODROP`` on the XPUB socket
|
## Whether to configure ``ZMQ_XPUB_NODROP`` on the XPUB socket
|
||||||
## to detect when sending a message fails due to reaching
|
## connecting to the proxy to detect when sending a message fails
|
||||||
## the high-water-mark.
|
## due to reaching the high-water-mark.
|
||||||
##
|
##
|
||||||
## See ZeroMQ's `ZMQ_XPUB_NODROP documentation <http://api.zeromq.org/4-2:zmq-setsockopt#toc61>`_
|
## See ZeroMQ's `ZMQ_XPUB_NODROP documentation <http://api.zeromq.org/4-2:zmq-setsockopt#toc61>`_
|
||||||
## for more details.
|
## for more details.
|
||||||
const xpub_nodrop: bool = T &redef;
|
const connect_xpub_nodrop: bool = T &redef;
|
||||||
|
|
||||||
## Do not silently drop messages if high-water-mark is reached.
|
## Do not silently drop messages if high-water-mark is reached.
|
||||||
##
|
##
|
||||||
|
|
|
@ -89,8 +89,12 @@ void ZeroMQBackend::DoInitPostScript() {
|
||||||
zeek::id::find_val<zeek::StringVal>("Cluster::Backend::ZeroMQ::connect_xpub_endpoint")->ToStdString();
|
zeek::id::find_val<zeek::StringVal>("Cluster::Backend::ZeroMQ::connect_xpub_endpoint")->ToStdString();
|
||||||
connect_xsub_endpoint =
|
connect_xsub_endpoint =
|
||||||
zeek::id::find_val<zeek::StringVal>("Cluster::Backend::ZeroMQ::connect_xsub_endpoint")->ToStdString();
|
zeek::id::find_val<zeek::StringVal>("Cluster::Backend::ZeroMQ::connect_xsub_endpoint")->ToStdString();
|
||||||
|
connect_xpub_nodrop =
|
||||||
|
zeek::id::find_val<zeek::BoolVal>("Cluster::Backend::ZeroMQ::connect_xpub_nodrop")->AsBool() ? 1 : 0;
|
||||||
listen_log_endpoint =
|
listen_log_endpoint =
|
||||||
zeek::id::find_val<zeek::StringVal>("Cluster::Backend::ZeroMQ::listen_log_endpoint")->ToStdString();
|
zeek::id::find_val<zeek::StringVal>("Cluster::Backend::ZeroMQ::listen_log_endpoint")->ToStdString();
|
||||||
|
|
||||||
|
linger_ms = static_cast<int>(zeek::id::find_val<zeek::IntVal>("Cluster::Backend::ZeroMQ::linger_ms")->AsInt());
|
||||||
poll_max_messages = zeek::id::find_val<zeek::CountVal>("Cluster::Backend::ZeroMQ::poll_max_messages")->Get();
|
poll_max_messages = zeek::id::find_val<zeek::CountVal>("Cluster::Backend::ZeroMQ::poll_max_messages")->Get();
|
||||||
debug_flags = zeek::id::find_val<zeek::CountVal>("Cluster::Backend::ZeroMQ::debug_flags")->Get();
|
debug_flags = zeek::id::find_val<zeek::CountVal>("Cluster::Backend::ZeroMQ::debug_flags")->Get();
|
||||||
|
|
||||||
|
@ -131,16 +135,13 @@ bool ZeroMQBackend::DoInit() {
|
||||||
log_pull = zmq::socket_t(ctx, zmq::socket_type::pull);
|
log_pull = zmq::socket_t(ctx, zmq::socket_type::pull);
|
||||||
child_inproc = zmq::socket_t(ctx, zmq::socket_type::pair);
|
child_inproc = zmq::socket_t(ctx, zmq::socket_type::pair);
|
||||||
|
|
||||||
auto linger_ms = static_cast<int>(zeek::id::find_val<zeek::IntVal>("Cluster::Backend::ZeroMQ::linger_ms")->AsInt());
|
|
||||||
int xpub_nodrop = zeek::id::find_val<zeek::BoolVal>("Cluster::Backend::ZeroMQ::xpub_nodrop")->AsBool() ? 1 : 0;
|
|
||||||
|
|
||||||
xpub.set(zmq::sockopt::linger, linger_ms);
|
xpub.set(zmq::sockopt::linger, linger_ms);
|
||||||
xpub.set(zmq::sockopt::xpub_nodrop, xpub_nodrop);
|
|
||||||
|
|
||||||
// Enable XPUB_VERBOSE unconditional to enforce nodes receiving
|
// Enable XPUB_VERBOSE unconditional to enforce nodes receiving
|
||||||
// notifications about any new subscriptions, even if they have
|
// notifications about any new subscriptions, even if they have
|
||||||
// seen them before. This is needed to for the subscribe callback
|
// seen them before. This is needed to for the subscribe callback
|
||||||
// functionality to work reliably.
|
// functionality to work reliably.
|
||||||
|
xpub.set(zmq::sockopt::xpub_nodrop, connect_xpub_nodrop);
|
||||||
xpub.set(zmq::sockopt::xpub_verbose, 1);
|
xpub.set(zmq::sockopt::xpub_verbose, 1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -67,11 +67,13 @@ private:
|
||||||
// Script level variables.
|
// Script level variables.
|
||||||
std::string connect_xsub_endpoint;
|
std::string connect_xsub_endpoint;
|
||||||
std::string connect_xpub_endpoint;
|
std::string connect_xpub_endpoint;
|
||||||
|
int connect_xpub_nodrop = 1;
|
||||||
std::string listen_xsub_endpoint;
|
std::string listen_xsub_endpoint;
|
||||||
std::string listen_xpub_endpoint;
|
std::string listen_xpub_endpoint;
|
||||||
std::string listen_log_endpoint;
|
std::string listen_log_endpoint;
|
||||||
int listen_xpub_nodrop = 1;
|
int listen_xpub_nodrop = 1;
|
||||||
|
|
||||||
|
int linger_ms = 0;
|
||||||
zeek_uint_t poll_max_messages = 0;
|
zeek_uint_t poll_max_messages = 0;
|
||||||
zeek_uint_t debug_flags = 0;
|
zeek_uint_t debug_flags = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue