mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
EventMgr: Add Dispatch() with handler and args
Allow users to call event_mgr.Dispatch(handler, args) instead of constructing the Event instance themselves. Deprecate the old API and replace users. There's a subtle change that net_done() may be propagated via auto_publish() now, but that still needs opt-in from script land and likely no one did that, or else they'd expected to have it work anyhow.
This commit is contained in:
parent
6d97d5526a
commit
0e027fa4e3
7 changed files with 34 additions and 14 deletions
|
@ -106,12 +106,8 @@ void EventHandler::NewEvent(Args* vl) {
|
|||
return;
|
||||
|
||||
auto vargs = MakeCallArgumentVector(*vl, GetType()->Params());
|
||||
|
||||
auto ev = new Event(new_event, {
|
||||
make_intrusive<StringVal>(name),
|
||||
std::move(vargs),
|
||||
});
|
||||
event_mgr.Dispatch(ev);
|
||||
auto args = zeek::Args{make_intrusive<StringVal>(name), std::move(vargs)};
|
||||
event_mgr.Dispatch(new_event, std::move(args));
|
||||
}
|
||||
|
||||
uint64_t EventHandler::CallCount() const { return call_count ? call_count->Value() : 0; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue