mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
add Terminate to input framework to prevent potential shutdown race-conditions.
This commit is contained in:
parent
a32bb59770
commit
3517c0ba99
3 changed files with 22 additions and 0 deletions
|
@ -1289,6 +1289,7 @@ void Manager::SendEndOfData(ReaderFrontend* reader)
|
||||||
SendEndOfData(i);
|
SendEndOfData(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Manager::SendEndOfData(const Stream *i)
|
void Manager::SendEndOfData(const Stream *i)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -2174,3 +2175,18 @@ Manager::Stream* Manager::FindStream(ReaderFrontend* reader)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function is called on Bro shutdown.
|
||||||
|
// sinal all frontends that they will cease operation.
|
||||||
|
void Manager::Terminate()
|
||||||
|
{
|
||||||
|
for (map<ReaderFrontend*, Stream*>::iterator i = readers.begin(); i != readers.end(); ++i )
|
||||||
|
{
|
||||||
|
if ( i->second->removed )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
i->second->removed = true;
|
||||||
|
i->second->reader->Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -79,6 +79,11 @@ public:
|
||||||
*/
|
*/
|
||||||
bool RemoveStream(const string &id);
|
bool RemoveStream(const string &id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signals the manager to shutdown at Bro's termination.
|
||||||
|
*/
|
||||||
|
void Terminate();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class ReaderFrontend;
|
friend class ReaderFrontend;
|
||||||
friend class PutMessage;
|
friend class PutMessage;
|
||||||
|
|
|
@ -357,6 +357,7 @@ void terminate_bro()
|
||||||
|
|
||||||
file_mgr->Terminate();
|
file_mgr->Terminate();
|
||||||
log_mgr->Terminate();
|
log_mgr->Terminate();
|
||||||
|
input_mgr->Terminate();
|
||||||
thread_mgr->Terminate();
|
thread_mgr->Terminate();
|
||||||
|
|
||||||
mgr.Drain();
|
mgr.Drain();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue