cluster/zeromq: Fix Unsubscribe() bug caused by \x00 prefix

This commit is contained in:
Arne Welzel 2025-01-28 14:37:27 +01:00
parent e8f87019c6
commit 9c5c0f40e1
4 changed files with 95 additions and 1 deletions

View file

@ -297,7 +297,7 @@ bool ZeroMQBackend::DoUnsubscribe(const std::string& topic_prefix) {
try {
// Prepend 0x00 byte to indicate subscription to XSUB socket.
// This is the XSUB API instead of setsockopt(ZMQ_SUBSCRIBE).
std::string msg = "\x00" + topic_prefix;
std::string msg = '\0' + topic_prefix;
main_inproc.send(zmq::const_buffer(msg.data(), msg.size()));
} catch ( zmq::error_t& err ) {
zeek::reporter->Error("Failed to unsubscribe from topic %s: %s", topic_prefix.c_str(), err.what());