mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 21:18:20 +00:00
Preventing the event processing from looping endlessly when an event
reraised itself during execution of its handlers.
This commit is contained in:
parent
ddabd13097
commit
2335a62a07
6 changed files with 67 additions and 25 deletions
1
testing/btest/Baseline/core.recursive-event/output
Normal file
1
testing/btest/Baseline/core.recursive-event/output
Normal file
|
@ -0,0 +1 @@
|
|||
10
|
31
testing/btest/core/recursive-event.bro
Normal file
31
testing/btest/core/recursive-event.bro
Normal file
|
@ -0,0 +1,31 @@
|
|||
# @TEST-EXEC: bro %INPUT 2>&1 | grep -v termination | sort | uniq | wc -l >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# In old version, the event would keep triggering endlessely, with the network
|
||||
# time not moving forward and Bro not terminating.
|
||||
#
|
||||
# Note that the output will be 10 (not 20) because we still execute two rounds
|
||||
# of events every time we drain.
|
||||
|
||||
redef exit_only_after_terminate=T;
|
||||
|
||||
global c = 0;
|
||||
|
||||
event test()
|
||||
{
|
||||
c += 1;
|
||||
|
||||
if ( c == 20 )
|
||||
{
|
||||
terminate();
|
||||
return;
|
||||
}
|
||||
|
||||
print network_time();
|
||||
event test();
|
||||
}
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
event test();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue