mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Prevent double-wrapping Broker::Data in published event args
In the following example, the republication of "arg" would result in literally sending it as a Broker::Data record instead of the broker data that it was already wrapping. Sender: Broker::publish("topic", my_event, "hello") Receiver: event my_event(arg: any) { Broker::publish("topic", my_event, arg) }
This commit is contained in:
parent
e33a3a9c02
commit
06e7f18a32
4 changed files with 20 additions and 4 deletions
|
@ -69,7 +69,7 @@ const events_to_recv = 5;
|
|||
global handler: event(msg: string, c: count);
|
||||
global auto_handler: event(msg: string, c: count);
|
||||
|
||||
global pong: event(msg: string, c: count);
|
||||
global pong: event(msg: string, c: any);
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
|
@ -101,7 +101,11 @@ event ping(msg: string, n: any)
|
|||
return;
|
||||
}
|
||||
|
||||
Broker::publish("bro/event/my_topic", pong, msg, n as count);
|
||||
if ( (n as count) % 2 == 0 )
|
||||
Broker::publish("bro/event/my_topic", pong, msg, n as count);
|
||||
else
|
||||
# internals should not wrap n into another Broker::Data record
|
||||
Broker::publish("bro/event/my_topic", pong, msg, n);
|
||||
}
|
||||
|
||||
@TEST-END-FILE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue