mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
logging/Manager: Implement DelayTokenType as an actual opaque
With a bit of tweaking in the JavaScript plugin to support opaque types, this will allow the delay functionality to work there, too. Making the LogDelayToken an actual opaque seems reasonable, too. It's not supposed to be user inspected.
This commit is contained in:
parent
2dbb467ba2
commit
5e046eee58
13 changed files with 130 additions and 32 deletions
|
@ -106,3 +106,17 @@ hook Log::log_stream_policy(rec: Info, id: Log::ID)
|
|||
Log::delay(id, rec);
|
||||
Log::delay(id, rec);
|
||||
}
|
||||
|
||||
@TEST-START-NEXT
|
||||
# Delay twice, never release, print the token value and its JSON representation.
|
||||
hook Log::log_stream_policy(rec: Info, id: Log::ID)
|
||||
{
|
||||
if ( id != LOG )
|
||||
return;
|
||||
|
||||
print network_time(), "log_stream_policy", id, rec$uid;
|
||||
|
||||
local token = Log::delay(id, rec);
|
||||
print "token", token;
|
||||
print "to_json(token)", to_json(token);
|
||||
}
|
||||
|
|
|
@ -33,16 +33,6 @@ hook Log::log_stream_policy(rec: Conn::Info, id: Log::ID)
|
|||
@TEST-START-NEXT
|
||||
@load base/protocols/conn
|
||||
|
||||
hook Log::log_stream_policy(rec: Conn::Info, id: Log::ID)
|
||||
{
|
||||
# Wrong token for delay_finish()
|
||||
local token = Log::delay(id, rec);
|
||||
Log::delay_finish(id, rec, 42);
|
||||
}
|
||||
|
||||
@TEST-START-NEXT
|
||||
@load base/protocols/conn
|
||||
|
||||
hook Log::log_stream_policy(rec: Conn::Info, id: Log::ID)
|
||||
{
|
||||
# Wrong record for delay_finish()
|
||||
|
@ -53,16 +43,6 @@ hook Log::log_stream_policy(rec: Conn::Info, id: Log::ID)
|
|||
@TEST-START-NEXT
|
||||
@load base/protocols/conn
|
||||
|
||||
hook Log::log_stream_policy(rec: Conn::Info, id: Log::ID)
|
||||
{
|
||||
# Wrong token type for delay_finish()
|
||||
local token = Log::delay(id, rec);
|
||||
Log::delay_finish(id, rec, "42");
|
||||
}
|
||||
|
||||
@TEST-START-NEXT
|
||||
@load base/protocols/conn
|
||||
|
||||
hook Log::log_stream_policy(rec: Conn::Info, id: Log::ID)
|
||||
{
|
||||
# Delay underflow.
|
||||
|
|
|
@ -31,3 +31,25 @@ hook Log::log_stream_policy(rec: Conn::Info, id: Log::ID)
|
|||
{
|
||||
Log::delay(id, rec, post_delay_cb);
|
||||
}
|
||||
|
||||
@TEST-START-NEXT
|
||||
# Bad token type 1
|
||||
@load base/protocols/conn
|
||||
|
||||
hook Log::log_stream_policy(rec: Conn::Info, id: Log::ID)
|
||||
{
|
||||
# Wrong token type for delay_finish()
|
||||
local token = Log::delay(id, rec);
|
||||
Log::delay_finish(id, rec, "42");
|
||||
}
|
||||
|
||||
@TEST-START-NEXT
|
||||
# Bad token type 2
|
||||
@load base/protocols/conn
|
||||
|
||||
hook Log::log_stream_policy(rec: Conn::Info, id: Log::ID)
|
||||
{
|
||||
# Wrong token type for delay_finish()
|
||||
local token = Log::delay(id, rec);
|
||||
Log::delay_finish(id, rec, 42);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue