hooks to support event tracing

This commit is contained in:
Vern Paxson 2022-02-08 17:07:40 -08:00 committed by Christian Kreibich
parent 25e096b50a
commit 39cbd7a9dc
4 changed files with 40 additions and 1 deletions

View file

@ -26,6 +26,7 @@
#include "zeek/Desc.h"
#include "zeek/Event.h"
#include "zeek/EventRegistry.h"
#include "zeek/EventTrace.h"
#include "zeek/File.h"
#include "zeek/Frag.h"
#include "zeek/Frame.h"
@ -299,8 +300,19 @@ static void terminate_zeek()
event_mgr.Enqueue(zeek_done, Args{});
timer_mgr->Expire();
// Drain() limits how many "generations" of newly created events
// it will process. When we're terminating, however, we're okay
// with long chains of events, and this makes the workings of
// event-tracing simpler.
//
// That said, we also need to ensure that it runs at least once,
// as it has side effects such as tickling triggers.
event_mgr.Drain();
while ( event_mgr.HasEvents() )
event_mgr.Drain();
if ( profiling_logger )
{
// FIXME: There are some occasional crashes in the memory