mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
Merge remote-tracking branch 'origin/topic/vern/when-lambda'
* origin/topic/vern/when-lambda: explicitly provide the frame for evaluating a "when" timeout expression attempt to make "when" btest deterministic tests for new "when" semantics/errors update existing test suite usage of "when" statements to include captures update uses of "when" in base scripts to include captures captures for "when" statements update Triggers to IntrusivePtr's and simpler AST traversal introduce IDSet type, migrate associated "ID*" types to "const ID*" logic (other than in profiling) for assignments that yield separate values option for internal use to mark a function type as allowing non-expression returns removed some now-obsolete profiling functionality minor commenting clarifications
This commit is contained in:
commit
3d9d6e953b
56 changed files with 931 additions and 255 deletions
|
@ -212,7 +212,7 @@ function pretty_print_alarm(out: file, n: Info)
|
|||
return;
|
||||
}
|
||||
|
||||
when ( local h1name = lookup_addr(h1) )
|
||||
when [out, n, h1, h2, line1, line2, line3] ( local h1name = lookup_addr(h1) )
|
||||
{
|
||||
if ( h2 == 0.0.0.0 )
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ function pretty_print_alarm(out: file, n: Info)
|
|||
return;
|
||||
}
|
||||
|
||||
when ( local h2name = lookup_addr(h2) )
|
||||
when [out, n, h1, h2, line1, line2, line3, h1name] ( local h2name = lookup_addr(h2) )
|
||||
{
|
||||
do_msg(out, n, line1, line2, line3, h1, h1name, h2, h2name);
|
||||
return;
|
||||
|
@ -240,7 +240,7 @@ function pretty_print_alarm(out: file, n: Info)
|
|||
return;
|
||||
}
|
||||
|
||||
when ( local h2name_ = lookup_addr(h2) )
|
||||
when [out, n, h1, h2, line1, line2, line3] ( local h2name_ = lookup_addr(h2) )
|
||||
{
|
||||
do_msg(out, n, line1, line2, line3, h1, "(dns timeout)", h2, h2name_);
|
||||
return;
|
||||
|
|
|
@ -135,9 +135,9 @@ function ryu_flow_mod(state: OpenFlow::ControllerState, match: ofp_match, flow_m
|
|||
);
|
||||
|
||||
# Execute call to Ryu's ReST API
|
||||
when ( local result = ActiveHTTP::request(request) )
|
||||
when [state, match, flow_mod, request] ( local result = ActiveHTTP::request(request) )
|
||||
{
|
||||
if(result$code == 200)
|
||||
if (result$code == 200)
|
||||
event OpenFlow::flow_mod_success(state$_name, match, flow_mod, result$body);
|
||||
else
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ function ryu_flow_clear(state: OpenFlow::ControllerState): bool
|
|||
$method="DELETE"
|
||||
);
|
||||
|
||||
when ( local result = ActiveHTTP::request(request) )
|
||||
when [request] ( local result = ActiveHTTP::request(request) )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ function data_added(ss: SumStat, key: Key, result: Result)
|
|||
function request(ss_name: string): ResultTable
|
||||
{
|
||||
# This only needs to be implemented this way for cluster compatibility.
|
||||
return when ( T )
|
||||
return when [ss_name] ( T )
|
||||
{
|
||||
if ( ss_name in result_store )
|
||||
return result_store[ss_name];
|
||||
|
@ -86,7 +86,7 @@ function request(ss_name: string): ResultTable
|
|||
function request_key(ss_name: string, key: Key): Result
|
||||
{
|
||||
# This only needs to be implemented this way for cluster compatibility.
|
||||
return when ( T )
|
||||
return when [ss_name, key] ( T )
|
||||
{
|
||||
if ( ss_name in result_store && key in result_store[ss_name] )
|
||||
return result_store[ss_name][key];
|
||||
|
|
|
@ -225,7 +225,7 @@ function log_record(info: Info)
|
|||
}
|
||||
else
|
||||
{
|
||||
when ( |info$delay_tokens| == 0 )
|
||||
when [info] ( |info$delay_tokens| == 0 )
|
||||
{
|
||||
log_record(info);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ function request(req: Request): ActiveHTTP::Response
|
|||
local cmd = request2curl(req, bodyfile, headersfile);
|
||||
local stdin_data = req?$client_data ? req$client_data : "";
|
||||
|
||||
return when ( local result = Exec::run([$cmd=cmd, $stdin=stdin_data, $read_files=set(bodyfile, headersfile)]) )
|
||||
return when [req, resp, cmd, stdin_data, bodyfile, headersfile] ( local result = Exec::run([$cmd=cmd, $stdin=stdin_data, $read_files=set(bodyfile, headersfile)]) )
|
||||
{
|
||||
# If there is no response line then nothing else will work either.
|
||||
if ( ! (result?$files && headersfile in result$files) )
|
||||
|
|
|
@ -28,7 +28,7 @@ event Dir::monitor_ev(dir: string, last_files: set[string],
|
|||
callback: function(fname: string),
|
||||
poll_interval: interval)
|
||||
{
|
||||
when ( local result = Exec::run([$cmd=fmt("ls -1 %s/", safe_shell_quote(dir))]) )
|
||||
when [dir, last_files, callback, poll_interval] ( local result = Exec::run([$cmd=fmt("ls -1 %s/", safe_shell_quote(dir))]) )
|
||||
{
|
||||
if ( result$exit_code != 0 )
|
||||
{
|
||||
|
|
|
@ -178,7 +178,7 @@ function run(cmd: Command): Result
|
|||
$want_record=F,
|
||||
$config=config_strings]);
|
||||
|
||||
return when ( cmd$uid !in pending_commands )
|
||||
return when [cmd] ( cmd$uid !in pending_commands )
|
||||
{
|
||||
local result = results[cmd$uid];
|
||||
delete results[cmd$uid];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue