mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Allow arbitrary when statement timeout expressions
BIT-1284 #close
This commit is contained in:
parent
285f93b689
commit
2a181a88c5
4 changed files with 24 additions and 6 deletions
|
@ -131,18 +131,19 @@ Trigger::Trigger(Expr* arg_cond, Stmt* arg_body, Stmt* arg_timeout_stmts,
|
|||
arg_frame->SetDelayed();
|
||||
}
|
||||
|
||||
Val* timeout = arg_timeout ? arg_timeout->ExprVal() : 0;
|
||||
Val* timeout_val = arg_timeout ? arg_timeout->Eval(arg_frame) : 0;
|
||||
|
||||
// Make sure we don't get deleted if somebody calls a method like
|
||||
// Timeout() while evaluating the trigger.
|
||||
Ref(this);
|
||||
|
||||
if ( ! Eval() && timeout )
|
||||
if ( ! Eval() && timeout_val )
|
||||
{
|
||||
timer = new TriggerTimer(timeout->AsInterval(), this);
|
||||
timer = new TriggerTimer(timeout_val->AsInterval(), this);
|
||||
timer_mgr->Add(timer);
|
||||
}
|
||||
|
||||
Unref(timeout_val);
|
||||
Unref(this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue