mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
broker integration: add Comm::enable function
Works like old enable_communication(), but for new broker communication mechanism. Scripts have to explicitly call this if they want to use the broker communication functionality. Saves a decent chunk of Bros' initialization time when one doesn't need communication features.
This commit is contained in:
parent
0cf982f1d1
commit
4dfec04135
12 changed files with 108 additions and 26 deletions
13
src/Net.cc
13
src/Net.cc
|
@ -34,6 +34,10 @@
|
|||
#include "iosource/PktDumper.h"
|
||||
#include "plugin/Manager.h"
|
||||
|
||||
#ifdef ENABLE_BROKER
|
||||
#include "comm/Manager.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include "setsignal.h"
|
||||
};
|
||||
|
@ -315,6 +319,11 @@ void net_run()
|
|||
}
|
||||
#endif
|
||||
current_iosrc = src;
|
||||
bool communication_enabled = using_communication;
|
||||
|
||||
#ifdef ENABLE_BROKER
|
||||
communication_enabled |= comm_mgr->Enabled();
|
||||
#endif
|
||||
|
||||
if ( src )
|
||||
src->Process(); // which will call net_packet_dispatch()
|
||||
|
@ -332,7 +341,7 @@ void net_run()
|
|||
}
|
||||
}
|
||||
|
||||
else if ( (have_pending_timers || using_communication) &&
|
||||
else if ( (have_pending_timers || communication_enabled) &&
|
||||
! pseudo_realtime )
|
||||
{
|
||||
// Take advantage of the lull to get up to
|
||||
|
@ -347,7 +356,7 @@ void net_run()
|
|||
// us a lot of idle time, but doesn't delay near-term
|
||||
// timers too much. (Delaying them somewhat is okay,
|
||||
// since Bro timers are not high-precision anyway.)
|
||||
if ( ! using_communication )
|
||||
if ( ! communication_enabled )
|
||||
usleep(100000);
|
||||
else
|
||||
usleep(1000);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue