diff --git a/src/Event.cc b/src/Event.cc index ead50a1ad8..643484583f 100644 --- a/src/Event.cc +++ b/src/Event.cc @@ -99,7 +99,6 @@ void EventMgr::QueueEvent(Event* event) { if ( ! head ) { head = tail = event; - queue_flare.Fire(); } else { tail->SetNext(event); @@ -177,25 +176,12 @@ void EventMgr::Describe(ODesc* d) const { } void EventMgr::Process() { - queue_flare.Extinguish(); - // While it semes like the most logical thing to do, we dont want // to call Drain() as part of this method. It will get called at - // the end of net_run after all of the sources have been processed + // the end of run_loop after all of the sources have been processed // and had the opportunity to spawn new events. } -void EventMgr::InitPostScript() { - iosource_mgr->Register(this, true, false); - if ( ! iosource_mgr->RegisterFd(queue_flare.FD(), this) ) - reporter->FatalError("Failed to register event manager FD with iosource_mgr"); -} - -void EventMgr::InitPostFork() { - // Re-initialize the flare, closing and re-opening the underlying - // pipe FDs. This is needed so that each Zeek process in a supervisor - // setup has its own pipe instead of them all sharing a single pipe. - queue_flare = zeek::detail::Flare{}; -} +void EventMgr::InitPostScript() { iosource_mgr->Register(this, true, false); } } // namespace zeek diff --git a/src/Event.h b/src/Event.h index 2fc9ee0e53..a1789aed87 100644 --- a/src/Event.h +++ b/src/Event.h @@ -106,14 +106,14 @@ public: void Describe(ODesc* d) const override; - double GetNextTimeout() override { return -1; } + // Let the IO loop know when there's more events to process + // by returning a zero-timeout. + double GetNextTimeout() override { return head ? 0.0 : -1.0; } + void Process() override; const char* Tag() override { return "EventManager"; } void InitPostScript(); - // Initialization to be done after a fork() happened. - void InitPostFork(); - uint64_t num_events_queued = 0; uint64_t num_events_dispatched = 0; @@ -127,7 +127,6 @@ protected: double current_ts; RecordVal* src_val; bool draining; - detail::Flare queue_flare; }; extern EventMgr event_mgr; diff --git a/src/zeek-setup.cc b/src/zeek-setup.cc index afe5cec284..4b351887aa 100644 --- a/src/zeek-setup.cc +++ b/src/zeek-setup.cc @@ -506,8 +506,6 @@ SetupResult setup(int argc, char** argv, Options* zopts) { // If we get here, we're a supervised node that just returned // from CreateStem() after being forked from the stem. Supervisor::ThisNode()->Init(&options); - - event_mgr.InitPostFork(); } script_coverage_mgr.ReadStats();