From 0bc1d73c84a63807cf464c1e0eace8e742ae6cfd Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Wed, 10 Jun 2020 16:30:56 -0700 Subject: [PATCH] Optimize Connection::RemovalEvent() for bare-mode usage It was creating RecordVals even if they wouldn't be used by any event handler and that situation is common/expected for `zeek -b` mode. Normally, there's at least the tunnel scripts with a `new_connection` handler causing the connection RecordVals to be built. --- CHANGES | 9 +++++++++ VERSION | 2 +- src/Conn.cc | 6 ++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index fcde672646..cdff7874ce 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,13 @@ +3.2.0-dev.763 | 2020-06-10 16:34:31 -0700 + + * Optimize Connection::RemovalEvent() for bare-mode usage (Jon Siwek, Corelight) + + It was creating RecordVals even if they wouldn't be used by any event + handler and that situation is common/expected for `zeek -b` mode. + Normally, there's at least the tunnel scripts with a `new_connection` + handler causing the connection RecordVals to be built. + 3.2.0-dev.762 | 2020-06-09 15:19:15 -0700 * Restrict Cirrus CI to only zeek repo's branches (Jon Siwek, Corelight) diff --git a/VERSION b/VERSION index 6fdff819de..d30372865c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.0-dev.762 +3.2.0-dev.763 diff --git a/src/Conn.cc b/src/Conn.cc index 47a5279fd2..f934a025de 100644 --- a/src/Conn.cc +++ b/src/Conn.cc @@ -457,13 +457,11 @@ void Connection::Match(Rule::PatternType type, const u_char* data, int len, bool void Connection::RemovalEvent() { - auto cv = ConnVal(); - if ( connection_state_remove ) - EnqueueEvent(connection_state_remove, nullptr, cv); + EnqueueEvent(connection_state_remove, nullptr, ConnVal()); if ( is_successful && successful_connection_remove ) - EnqueueEvent(successful_connection_remove, nullptr, cv); + EnqueueEvent(successful_connection_remove, nullptr, ConnVal()); } void Connection::Event(EventHandlerPtr f, analyzer::Analyzer* analyzer, const char* name)