mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Rewrite the btest for when-statement timeouts
To avoid a memory leak in DNS lookups that's hard to work around and does not otherwise effect typical operation when Zeek is allowed to continue to run after zeek_init().
This commit is contained in:
parent
09578c6176
commit
d917737766
2 changed files with 13 additions and 11 deletions
|
@ -1,19 +1,21 @@
|
|||
# @TEST-EXEC: unset ZEEK_DNS_FAKE && unset BRO_DNS_FAKE && zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-bg-run zeek zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff zeek/.stdout
|
||||
|
||||
redef exit_only_after_terminate=T;
|
||||
|
||||
global myset = set("yes");
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local h1: addr = 1.2.3.4;
|
||||
|
||||
when ( local h1name = lookup_addr(h1) )
|
||||
when ( "no" in myset )
|
||||
{
|
||||
print "lookup successful";
|
||||
terminate();
|
||||
}
|
||||
timeout 3 secs
|
||||
timeout 0.25sec
|
||||
{
|
||||
print "timeout";
|
||||
terminate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue