mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/timw/3662-ignore-disabled-writer-frontends'
* origin/topic/timw/3662-ignore-disabled-writer-frontends: Don't attempt to stop or flush disabled writer frontends
This commit is contained in:
commit
cbf9ff47e8
4 changed files with 30 additions and 1 deletions
4
CHANGES
4
CHANGES
|
@ -1,3 +1,7 @@
|
||||||
|
7.0.0-dev.147 | 2024-04-22 17:08:25 -0700
|
||||||
|
|
||||||
|
* Don't attempt to stop or flush disabled writer frontends (Tim Wojtulewicz, Corelight)
|
||||||
|
|
||||||
7.0.0-dev.145 | 2024-04-22 15:55:53 -0700
|
7.0.0-dev.145 | 2024-04-22 15:55:53 -0700
|
||||||
|
|
||||||
* Allow SMB_TCP record to contain multiple protocol identifiers/headers (Tim Wojtulewicz, Corelight)
|
* Allow SMB_TCP record to contain multiple protocol identifiers/headers (Tim Wojtulewicz, Corelight)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
7.0.0-dev.145
|
7.0.0-dev.147
|
||||||
|
|
|
@ -133,6 +133,11 @@ WriterFrontend::~WriterFrontend() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterFrontend::Stop() {
|
void WriterFrontend::Stop() {
|
||||||
|
if ( disabled ) {
|
||||||
|
CleanupWriteBuffer();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FlushWriteBuffer();
|
FlushWriteBuffer();
|
||||||
SetDisable();
|
SetDisable();
|
||||||
|
|
||||||
|
@ -204,6 +209,11 @@ void WriterFrontend::Write(int arg_num_fields, Value** vals) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterFrontend::FlushWriteBuffer() {
|
void WriterFrontend::FlushWriteBuffer() {
|
||||||
|
if ( disabled ) {
|
||||||
|
CleanupWriteBuffer();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! write_buffer_pos )
|
if ( ! write_buffer_pos )
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
return;
|
return;
|
||||||
|
@ -261,4 +271,16 @@ void WriterFrontend::DeleteVals(int num_fields, Value** vals) {
|
||||||
delete[] vals;
|
delete[] vals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WriterFrontend::CleanupWriteBuffer() {
|
||||||
|
if ( ! write_buffer || write_buffer_pos == 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
for ( int j = 0; j < write_buffer_pos; j++ )
|
||||||
|
DeleteVals(num_fields, write_buffer[j]);
|
||||||
|
|
||||||
|
delete[] write_buffer;
|
||||||
|
write_buffer = nullptr;
|
||||||
|
write_buffer_pos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace zeek::logging
|
} // namespace zeek::logging
|
||||||
|
|
|
@ -206,6 +206,9 @@ protected:
|
||||||
static const int WRITER_BUFFER_SIZE = 1000;
|
static const int WRITER_BUFFER_SIZE = 1000;
|
||||||
int write_buffer_pos; // Position of next write in buffer.
|
int write_buffer_pos; // Position of next write in buffer.
|
||||||
threading::Value*** write_buffer; // Buffer of size WRITER_BUFFER_SIZE.
|
threading::Value*** write_buffer; // Buffer of size WRITER_BUFFER_SIZE.
|
||||||
|
|
||||||
|
private:
|
||||||
|
void CleanupWriteBuffer();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace zeek::logging
|
} // namespace zeek::logging
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue