mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 23:28:20 +00:00
Improve file analysis manager shutdown/cleanup.
file_analysis::Manager's dtor now doesn't assume any more analysis progress can be made because too many of Bro's other subsystems are shutdown by that point. Any file analysis requests made after Terminate cannot be reliably processed.
This commit is contained in:
parent
b029d18336
commit
4b059ea15a
2 changed files with 22 additions and 2 deletions
|
@ -27,7 +27,22 @@ Manager::Manager()
|
|||
|
||||
Manager::~Manager()
|
||||
{
|
||||
Terminate();
|
||||
// Have to assume that too much of Bro has been shutdown by this point
|
||||
// to do anything more than reclaim memory.
|
||||
|
||||
File* f;
|
||||
bool* b;
|
||||
|
||||
IterCookie* it = id_map.InitForIteration();
|
||||
|
||||
while ( (f = id_map.NextEntry(it)) )
|
||||
delete f;
|
||||
|
||||
it = ignored.InitForIteration();
|
||||
|
||||
while( (b = ignored.NextEntry(it)) )
|
||||
delete b;
|
||||
|
||||
delete magic_state;
|
||||
}
|
||||
|
||||
|
@ -58,10 +73,15 @@ void Manager::Terminate()
|
|||
HashKey* key;
|
||||
|
||||
while ( id_map.NextEntry(key, it) )
|
||||
{
|
||||
keys.push_back(static_cast<const char*>(key->Key()));
|
||||
delete key;
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < keys.size(); ++i )
|
||||
Timeout(keys[i], true);
|
||||
|
||||
mgr.Drain();
|
||||
}
|
||||
|
||||
string Manager::HashHandle(const string& handle) const
|
||||
|
|
|
@ -379,10 +379,10 @@ void terminate_bro()
|
|||
delete secondary_path;
|
||||
delete remote_serializer;
|
||||
delete analyzer_mgr;
|
||||
delete file_mgr;
|
||||
delete log_mgr;
|
||||
delete plugin_mgr;
|
||||
delete thread_mgr;
|
||||
delete file_mgr;
|
||||
delete reporter;
|
||||
|
||||
reporter = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue