cluster/zeromq: Use NodeId(), drop my_node_id

This commit is contained in:
Arne Welzel 2025-01-10 19:48:31 +01:00
parent 769044e8e1
commit df78a94c76
2 changed files with 3 additions and 5 deletions

View file

@ -80,7 +80,6 @@ ZeroMQBackend::ZeroMQBackend(std::unique_ptr<EventSerializer> es, std::unique_pt
void ZeroMQBackend::DoInitPostScript() {
ThreadedBackend::DoInitPostScript();
my_node_id = zeek::id::find_val<zeek::StringVal>("Cluster::Backend::ZeroMQ::my_node_id")->ToStdString();
listen_xpub_endpoint =
zeek::id::find_val<zeek::StringVal>("Cluster::Backend::ZeroMQ::listen_xpub_endpoint")->ToStdString();
listen_xsub_endpoint =
@ -241,7 +240,7 @@ bool ZeroMQBackend::DoPublishEvent(const std::string& topic, const std::string&
// * The serialized event itself.
std::array<zmq::const_buffer, 4> parts = {
zmq::const_buffer(topic.data(), topic.size()),
zmq::const_buffer(my_node_id.data(), my_node_id.size()),
zmq::const_buffer(NodeId().data(), NodeId().size()),
zmq::const_buffer(format.data(), format.size()),
zmq::const_buffer(buf.data(), buf.size()),
};
@ -305,7 +304,7 @@ bool ZeroMQBackend::DoPublishLogWrites(const logging::detail::LogWriteHeader& he
// * The serialized log write itself.
std::array<zmq::const_buffer, 4> parts = {
zmq::const_buffer{message_type.data(), message_type.size()},
zmq::const_buffer(my_node_id.data(), my_node_id.size()),
zmq::const_buffer(NodeId().data(), NodeId().size()),
zmq::const_buffer{format.data(), format.size()},
zmq::const_buffer{buf.data(), buf.size()},
};
@ -438,7 +437,7 @@ void ZeroMQBackend::Run() {
// Filter out messages that are coming from this node.
std::string sender(msg[1].data<const char>(), msg[1].size());
if ( sender == my_node_id )
if ( sender == NodeId() )
continue;
detail::byte_buffer payload{msg[3].data<std::byte>(), msg[3].data<std::byte>() + msg[3].size()};