mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 12:08:20 +00:00
Add front-end name to InitMessage from WriterFrontend to Backend.
At the time WriterBackend::Init() happens, it's in a different thread than its frontend member, but tried to access it directly to get its name, that info is now sent in the InitMessage instead. (Problem was observed segfaulting the unit test scripts.base.frameworks.notice.mail-alarms on Ubuntu 12.04).
This commit is contained in:
parent
1bbd63970a
commit
41f1544332
3 changed files with 11 additions and 7 deletions
|
@ -15,16 +15,18 @@ namespace logging {
|
|||
class InitMessage : public threading::InputMessage<WriterBackend>
|
||||
{
|
||||
public:
|
||||
InitMessage(WriterBackend* backend, const string path, const int num_fields, const Field* const* fields)
|
||||
InitMessage(WriterBackend* backend, const string path, const int num_fields, const Field* const* fields, string frontend_name)
|
||||
: threading::InputMessage<WriterBackend>("Init", backend),
|
||||
path(path), num_fields(num_fields), fields(fields) { }
|
||||
path(path), num_fields(num_fields), fields(fields),
|
||||
frontend_name(frontend_name) { }
|
||||
|
||||
virtual bool Process() { return Object()->Init(path, num_fields, fields); }
|
||||
virtual bool Process() { return Object()->Init(path, num_fields, fields, frontend_name); }
|
||||
|
||||
private:
|
||||
const string path;
|
||||
const int num_fields;
|
||||
const Field * const* fields;
|
||||
const string frontend_name;
|
||||
};
|
||||
|
||||
class RotateMessage : public threading::InputMessage<WriterBackend>
|
||||
|
@ -164,7 +166,7 @@ void WriterFrontend::Init(string arg_path, int arg_num_fields, const Field* cons
|
|||
initialized = true;
|
||||
|
||||
if ( backend )
|
||||
backend->SendIn(new InitMessage(backend, arg_path, arg_num_fields, arg_fields));
|
||||
backend->SendIn(new InitMessage(backend, arg_path, arg_num_fields, arg_fields, Name()));
|
||||
|
||||
if ( remote )
|
||||
remote_serializer->SendLogCreateWriter(stream,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue