mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
GH-1768: Properly cleanup existing log stream when recreated on with the same ID
This commit is contained in:
parent
e7412e257f
commit
d50dade24c
2 changed files with 11 additions and 2 deletions
|
@ -311,8 +311,11 @@ bool Manager::CreateStream(EnumVal* id, RecordVal* sval)
|
|||
streams.push_back(nullptr);
|
||||
|
||||
if ( streams[idx] )
|
||||
// We already know this one, delete the previous definition.
|
||||
delete streams[idx];
|
||||
{
|
||||
// We already know this one. Clean up the old version before making
|
||||
// a new one.
|
||||
RemoveStream(idx);
|
||||
}
|
||||
|
||||
// Create new stream.
|
||||
streams[idx] = new Stream;
|
||||
|
@ -334,7 +337,11 @@ bool Manager::CreateStream(EnumVal* id, RecordVal* sval)
|
|||
bool Manager::RemoveStream(EnumVal* id)
|
||||
{
|
||||
unsigned int idx = id->AsEnum();
|
||||
return RemoveStream(idx);
|
||||
}
|
||||
|
||||
bool Manager::RemoveStream(unsigned int idx)
|
||||
{
|
||||
if ( idx >= streams.size() || ! streams[idx] )
|
||||
return false;
|
||||
|
||||
|
|
|
@ -299,6 +299,8 @@ private:
|
|||
bool CompareFields(const Filter* filter, const WriterFrontend* writer);
|
||||
bool CheckFilterWriterConflict(const WriterInfo* winfo, const Filter* filter);
|
||||
|
||||
bool RemoveStream(unsigned int idx);
|
||||
|
||||
std::vector<Stream*> streams; // Indexed by stream enum.
|
||||
int rotations_pending; // Number of rotations not yet finished.
|
||||
FuncPtr rotation_format_func;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue