Merge remote-tracking branch 'origin/topic/awelzel/no-broker-mgr-active'

* origin/topic/awelzel/no-broker-mgr-active:
  RunState: Drop broker_mgr->Active() usage
This commit is contained in:
Arne Welzel 2024-08-30 15:38:52 +02:00
commit 435770f99a
4 changed files with 34 additions and 8 deletions

30
CHANGES
View file

@ -1,3 +1,33 @@
7.1.0-dev.230 | 2024-08-30 15:38:52 +0200
* RunState: Drop broker_mgr->Active() usage (Arne Welzel, Corelight)
...and deprecate it. The communication_enabled flag doesn't really
make a difference in how the IO loop works.
* logging/WriterFrontend: No need for explicit CleanupWriteBuffer() (Arne Welzel, Corelight)
Any pending records will be cleaned in the destructor of WriterFrontend
and WriteBuffer, no need to do this explicitly.
* logging: Switch index-assignment of raw pointers to emplace_back() (Arne Welzel, Corelight)
* broker/logging: Change threading::Value** usage std::vector instead (Arne Welzel, Corelight)
This allows to leverage automatic memory management, less allocations
and using move semantics for expressing ownership.
This breaks the existing logging and broker API, but keeps the plugin
DoWrite() and HookLogWrite() methods functioning.
It further changes ValToLogVal to return a threading::Value rather than
a threading::Value*. The vector_val and set_val fields unfortunately
use the same pointer-to-array-of-pointers approach. this can'tbe changed
as it'd break backwards compatibility for plugin provided input readers
and log writers.
* threading/Value: Support move and copy constructors (Arne Welzel, Corelight)
7.1.0-dev.222 | 2024-08-27 13:29:12 +0100 7.1.0-dev.222 | 2024-08-27 13:29:12 +0100
* Fix parsing of version field in SSLv2 client hello (Johanna Amann, Corelight) * Fix parsing of version field in SSLv2 client hello (Johanna Amann, Corelight)

View file

@ -1 +1 @@
7.1.0-dev.222 7.1.0-dev.230

View file

@ -31,7 +31,6 @@ extern "C" {
#include "zeek/Reporter.h" #include "zeek/Reporter.h"
#include "zeek/Scope.h" #include "zeek/Scope.h"
#include "zeek/Timer.h" #include "zeek/Timer.h"
#include "zeek/broker/Manager.h"
#include "zeek/iosource/Manager.h" #include "zeek/iosource/Manager.h"
#include "zeek/iosource/PktDumper.h" #include "zeek/iosource/PktDumper.h"
#include "zeek/iosource/PktSrc.h" #include "zeek/iosource/PktSrc.h"
@ -275,8 +274,6 @@ void run_loop() {
} }
#endif #endif
current_iosrc = nullptr; current_iosrc = nullptr;
auto communication_enabled = broker_mgr->Active();
if ( ! ready.empty() ) { if ( ! ready.empty() ) {
for ( const auto& src : ready ) { for ( const auto& src : ready ) {
auto* iosrc = src.src; auto* iosrc = src.src;
@ -289,8 +286,7 @@ void run_loop() {
iosrc->Process(); iosrc->Process();
} }
} }
else if ( (have_pending_timers || communication_enabled || BifConst::exit_only_after_terminate) && else if ( (have_pending_timers || BifConst::exit_only_after_terminate) && pseudo_realtime == 0.0 ) {
! pseudo_realtime ) {
// Take advantage of the lull to get up to // Take advantage of the lull to get up to
// date on timers and events. Because we only // date on timers and events. Because we only
// have timers as sources, going to sleep here // have timers as sources, going to sleep here
@ -330,7 +326,7 @@ void run_loop() {
// Terminate if we're running pseudo_realtime and // Terminate if we're running pseudo_realtime and
// the interface has been closed. // the interface has been closed.
if ( pseudo_realtime && communication_enabled ) { if ( pseudo_realtime != 0.0 ) {
iosource::PktSrc* ps = iosource_mgr->GetPktSrc(); iosource::PktSrc* ps = iosource_mgr->GetPktSrc();
if ( ps && ! ps->IsOpen() ) if ( ps && ! ps->IsOpen() )
iosource_mgr->Terminate(); iosource_mgr->Terminate();

View file

@ -109,7 +109,7 @@ public:
/** /**
* Returns true if any Broker communication is currently active. * Returns true if any Broker communication is currently active.
*/ */
bool Active(); [[deprecated("Remove with v8.1 - unused")]] bool Active();
/** /**
* Advances time. Broker data store expiration is driven by this * Advances time. Broker data store expiration is driven by this