mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Fix log manager hanging on waiting for pending file rotations.
This changes writer implementations to always respond to rotation messages in their DoRotate() method, even for failure/no-op cases with a new RotationFailedMessage. This informs the manager to decrement its count of pending rotations. Addresses #860.
This commit is contained in:
parent
4bdac985cb
commit
4359bf6b42
8 changed files with 79 additions and 1 deletions
|
@ -43,6 +43,32 @@ private:
|
|||
bool terminating;
|
||||
};
|
||||
|
||||
class RotationFailedMessage : public threading::OutputMessage<WriterFrontend>
|
||||
{
|
||||
public:
|
||||
RotationFailedMessage(WriterFrontend* writer, const char* filename,
|
||||
double open, double close, bool terminating)
|
||||
: threading::OutputMessage<WriterFrontend>("RotationFailed", writer),
|
||||
filename(copy_string(filename)), open(open),
|
||||
close(close), terminating(terminating) { }
|
||||
|
||||
virtual ~RotationFailedMessage()
|
||||
{
|
||||
delete [] filename;
|
||||
}
|
||||
|
||||
virtual bool Process()
|
||||
{
|
||||
return log_mgr->FailedRotation(Object(), filename, open, close, terminating);
|
||||
}
|
||||
|
||||
private:
|
||||
const char* filename;
|
||||
double open;
|
||||
double close;
|
||||
bool terminating;
|
||||
};
|
||||
|
||||
class FlushWriteBufferMessage : public threading::OutputMessage<WriterFrontend>
|
||||
{
|
||||
public:
|
||||
|
@ -164,6 +190,13 @@ bool WriterBackend::FinishedRotation(const char* new_name, const char* old_name,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool WriterBackend::FailedRotation(const char* filename, double open,
|
||||
double close, bool terminating)
|
||||
{
|
||||
SendOut(new RotationFailedMessage(frontend, filename, open, close, terminating));
|
||||
return true;
|
||||
}
|
||||
|
||||
void WriterBackend::DisableFrontend()
|
||||
{
|
||||
SendOut(new DisableMessage(frontend));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue