logging/WriterFrontend: No need for explicit CleanupWriteBuffer()

Any pending records will be cleaned in the destructor of WriterFrontend
and WriteBuffer, no need to do this explicitly.
This commit is contained in:
Arne Welzel 2024-08-30 10:45:04 +02:00
parent a9290cc031
commit f0ab10a46c
2 changed files with 1 additions and 14 deletions

View file

@ -132,7 +132,6 @@ WriterFrontend::~WriterFrontend() {
void WriterFrontend::Stop() {
if ( disabled ) {
CleanupWriteBuffer();
return;
}
@ -198,10 +197,8 @@ void WriterFrontend::Write(detail::LogRecord&& arg_vals) {
}
void WriterFrontend::FlushWriteBuffer() {
if ( disabled ) {
CleanupWriteBuffer();
if ( disabled )
return;
}
if ( write_buffer.Empty() )
// Nothing to do.
@ -248,6 +245,4 @@ void WriterFrontend::Rotate(const char* rotated_path, double open, double close,
log_mgr->FinishedRotation(this, nullptr, nullptr, 0, 0, false, terminating);
}
void WriterFrontend::CleanupWriteBuffer() { write_buffer.Clear(); }
} // namespace zeek::logging

View file

@ -61,11 +61,6 @@ public:
*/
bool Full() const { return records.size() >= buffer_size; }
/**
* Clear the records buffer.
*/
void Clear() { records.clear(); }
private:
size_t buffer_size;
std::vector<LogRecord> records;
@ -269,9 +264,6 @@ protected:
// Buffer for bulk writes.
static const int WRITER_BUFFER_SIZE = 1000;
detail::WriteBuffer write_buffer; // Buffer of size WRITER_BUFFER_SIZE.
private:
void CleanupWriteBuffer();
};
} // namespace zeek::logging