diff --git a/aux/bifcl b/aux/bifcl index 3fefee1630..92377e064d 160000 --- a/aux/bifcl +++ b/aux/bifcl @@ -1 +1 @@ -Subproject commit 3fefee1630269b96ea4f39021bf387b9d0abfd80 +Subproject commit 92377e064d925389b1732d105a674f2f761615e6 diff --git a/src/Conn.cc b/src/Conn.cc index a8987b30f5..64d32a7f5c 100644 --- a/src/Conn.cc +++ b/src/Conn.cc @@ -496,15 +496,14 @@ void Connection::ConnectionEvent(EventHandlerPtr f, analyzer::Analyzer* a, val_l return; // "this" is passed as a cookie for the event - mgr.Enqueue(f, std::move(args), SOURCE_LOCAL, - a ? a->GetID() : 0, timer_mgr, this); + mgr.Enqueue(f, std::move(args), SOURCE_LOCAL, a ? a->GetID() : 0, this); } void Connection::ConnectionEventFast(EventHandlerPtr f, analyzer::Analyzer* a, val_list vl) { // "this" is passed as a cookie for the event mgr.Enqueue(f, zeek::val_list_to_args(&vl), SOURCE_LOCAL, - a ? a->GetID() : 0, timer_mgr, this); + a ? a->GetID() : 0, this); } void Connection::ConnectionEvent(EventHandlerPtr f, analyzer::Analyzer* a, val_list* vl) @@ -520,8 +519,7 @@ void Connection::EnqueueEvent(EventHandlerPtr f, analyzer::Analyzer* a, zeek::Args args) { // "this" is passed as a cookie for the event - mgr.Enqueue(f, std::move(args), SOURCE_LOCAL, a ? a->GetID() : 0, - timer_mgr, this); + mgr.Enqueue(f, std::move(args), SOURCE_LOCAL, a ? a->GetID() : 0, this); } void Connection::Weird(const char* name, const char* addl) diff --git a/src/Event.cc b/src/Event.cc index 48334b98b2..6ad75d0325 100644 --- a/src/Event.cc +++ b/src/Event.cc @@ -19,13 +19,11 @@ uint64_t num_events_queued = 0; uint64_t num_events_dispatched = 0; Event::Event(EventHandlerPtr arg_handler, zeek::Args arg_args, - SourceID arg_src, analyzer::ID arg_aid, TimerMgr* arg_mgr, - BroObj* arg_obj) + SourceID arg_src, analyzer::ID arg_aid, BroObj* arg_obj) : handler(arg_handler), args(std::move(arg_args)), src(arg_src), aid(arg_aid), - mgr(arg_mgr ? arg_mgr : timer_mgr), obj(arg_obj), next_event(nullptr) { @@ -80,7 +78,6 @@ EventMgr::EventMgr() { head = tail = 0; current_src = SOURCE_LOCAL; - current_mgr = timer_mgr; current_aid = 0; src_val = 0; draining = 0; @@ -102,7 +99,7 @@ void EventMgr::QueueEventFast(const EventHandlerPtr &h, val_list vl, SourceID src, analyzer::ID aid, TimerMgr* mgr, BroObj* obj) { - QueueEvent(new Event(h, zeek::val_list_to_args(&vl), src, aid, mgr, obj)); + QueueEvent(new Event(h, zeek::val_list_to_args(&vl), src, aid, obj)); } void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list vl, @@ -112,7 +109,7 @@ void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list vl, auto args = zeek::val_list_to_args(&vl); if ( h ) - Enqueue(h, std::move(args), src, aid, mgr, obj); + Enqueue(h, std::move(args), src, aid, obj); } void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list* vl, @@ -123,14 +120,13 @@ void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list* vl, delete vl; if ( h ) - Enqueue(h, std::move(args), src, aid, mgr, obj); + Enqueue(h, std::move(args), src, aid, obj); } void EventMgr::Enqueue(const EventHandlerPtr& h, zeek::Args vl, - SourceID src, analyzer::ID aid, - TimerMgr* mgr, BroObj* obj) + SourceID src, analyzer::ID aid, BroObj* obj) { - QueueEvent(new Event(h, std::move(vl), src, aid, mgr, obj)); + QueueEvent(new Event(h, std::move(vl), src, aid, obj)); } void EventMgr::QueueEvent(Event* event) @@ -190,7 +186,6 @@ void EventMgr::Drain() Event* next = current->NextEvent(); current_src = current->Source(); - current_mgr = current->Mgr(); current_aid = current->Analyzer(); current->Dispatch(); Unref(current); diff --git a/src/Event.h b/src/Event.h index 754db32612..85496e3eb4 100644 --- a/src/Event.h +++ b/src/Event.h @@ -17,14 +17,13 @@ class Event : public BroObj { public: Event(EventHandlerPtr handler, zeek::Args args, SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0, - TimerMgr* mgr = nullptr, BroObj* obj = nullptr); + BroObj* obj = nullptr); void SetNext(Event* n) { next_event = n; } Event* NextEvent() const { return next_event; } SourceID Source() const { return src; } analyzer::ID Analyzer() const { return aid; } - TimerMgr* Mgr() const { return mgr; } EventHandlerPtr Handler() const { return handler; } const zeek::Args& Args() const { return args; } @@ -41,7 +40,6 @@ protected: zeek::Args args; SourceID src; analyzer::ID aid; - TimerMgr* mgr; BroObj* obj; Event* next_event; }; @@ -101,7 +99,7 @@ public: */ void Enqueue(const EventHandlerPtr& h, zeek::Args vl, SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0, - TimerMgr* mgr = nullptr, BroObj* obj = nullptr); + BroObj* obj = nullptr); /** * A version of Enqueue() taking a variable number of arguments. @@ -127,9 +125,6 @@ public: // non-analyzer event. analyzer::ID CurrentAnalyzer() const { return current_aid; } - // Returns the timer mgr associated with the last raised event. - TimerMgr* CurrentTimerMgr() const { return current_mgr; } - int Size() const { return num_events_queued - num_events_dispatched; } @@ -147,7 +142,6 @@ protected: Event* tail; SourceID current_src; analyzer::ID current_aid; - TimerMgr* current_mgr; RecordVal* src_val; bool draining; bro::Flare queue_flare; diff --git a/src/Expr.cc b/src/Expr.cc index 693ff316c2..56fae6d1fb 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -3885,9 +3885,9 @@ IntrusivePtr FlattenExpr::Fold(Val* v) const } ScheduleTimer::ScheduleTimer(EventHandlerPtr arg_event, zeek::Args arg_args, - double t, TimerMgr* arg_tmgr) + double t) : Timer(t, TIMER_SCHEDULE), - event(arg_event), args(std::move(arg_args)), tmgr(arg_tmgr) + event(arg_event), args(std::move(arg_args)) { } @@ -3898,7 +3898,7 @@ ScheduleTimer::~ScheduleTimer() void ScheduleTimer::Dispatch(double /* t */, int /* is_expire */) { if ( event ) - mgr.Enqueue(event, std::move(args), SOURCE_LOCAL, 0, tmgr); + mgr.Enqueue(event, std::move(args)); } ScheduleExpr::ScheduleExpr(IntrusivePtr arg_when, @@ -3940,14 +3940,7 @@ IntrusivePtr ScheduleExpr::Eval(Frame* f) const auto args = eval_list(f, event->Args()); if ( args ) - { - TimerMgr* tmgr = mgr.CurrentTimerMgr(); - - if ( ! tmgr ) - tmgr = timer_mgr; - - tmgr->Add(new ScheduleTimer(event->Handler(), std::move(*args), dt, tmgr)); - } + timer_mgr->Add(new ScheduleTimer(event->Handler(), std::move(*args), dt)); return nullptr; } diff --git a/src/Expr.h b/src/Expr.h index 48f02cd90e..d793389eba 100644 --- a/src/Expr.h +++ b/src/Expr.h @@ -740,8 +740,7 @@ protected: class ScheduleTimer : public Timer { public: - ScheduleTimer(EventHandlerPtr event, zeek::Args args, - double t, TimerMgr* tmgr); + ScheduleTimer(EventHandlerPtr event, zeek::Args args, double t); ~ScheduleTimer() override; void Dispatch(double t, int is_expire) override; @@ -749,7 +748,6 @@ public: protected: EventHandlerPtr event; zeek::Args args; - TimerMgr* tmgr; }; class ScheduleExpr : public Expr {