Move some code out of NetSessions

- TCPStateStats update when a session is removed was moved to Connection
- Stepping Stone manager moved to a singleton object in SteppingStoneManager
This commit is contained in:
Tim Wojtulewicz 2021-03-11 13:17:17 -07:00
parent 14ffd9646f
commit 50713b3c2d
7 changed files with 38 additions and 34 deletions

View file

@ -37,6 +37,7 @@ extern "C" {
#include "zeek/plugin/Manager.h"
#include "zeek/broker/Manager.h"
#include "zeek/packet_analysis/Manager.h"
#include "zeek/analyzer/protocol/stepping-stone/SteppingStone.h"
extern "C" {
extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
@ -45,6 +46,8 @@ extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
static double last_watchdog_proc_time = 0.0; // value of above during last watchdog
extern int signal_val;
using namespace zeek::analyzer::stepping_stone;
namespace zeek::run_state {
namespace detail {
@ -194,6 +197,9 @@ void init_run(const std::optional<std::string>& interface,
sessions = new NetSessions();
// Initialize the stepping stone manager. We intentionally throw away the result here.
SteppingStoneManager::Get();
if ( do_watchdog )
{
// Set up the watchdog to make sure we don't wedge.
@ -408,6 +414,7 @@ void delete_run()
util::detail::set_processing_status("TERMINATING", "delete_run");
delete sessions;
delete SteppingStoneManager::Get();
for ( int i = 0; i < zeek::detail::NUM_ADDR_ANONYMIZATION_METHODS; ++i )
delete zeek::detail::ip_anonymizer[i];