Merge remote-tracking branch 'origin/topic/bernhard/input-crash-search'

* origin/topic/bernhard/input-crash-search:
  for bug-searching:

Closes #840
This commit is contained in:
Robin Sommer 2012-07-02 15:02:56 -07:00
commit 9183309482
6 changed files with 28 additions and 9 deletions

10
CHANGES
View file

@ -1,4 +1,14 @@
2.0-723 | 2012-07-02 15:02:56 -0700
* Extract ICMPv6 NDP options and include in ICMP events. This adds
a new parameter of type "icmp6_nd_options" to the ICMPv6 neighbor
discovery events. Addresses #833. (Jon Siwek)
* Set input frontend type before starting the thread. This means
that the thread type will be output correctly in the error
message. (Bernhard Amann)
2.0-719 | 2012-07-02 14:49:03 -0700 2.0-719 | 2012-07-02 14:49:03 -0700
* Fix inconsistencies in random number generation. The * Fix inconsistencies in random number generation. The

View file

@ -1 +1 @@
2.0-719 2.0-723

View file

@ -255,10 +255,10 @@ ReaderBackend* Manager::CreateBackend(ReaderFrontend* frontend, bro_int_t type)
assert(ir->factory); assert(ir->factory);
frontend->SetTypeName(ir->name);
ReaderBackend* backend = (*ir->factory)(frontend); ReaderBackend* backend = (*ir->factory)(frontend);
assert(backend); assert(backend);
frontend->ty_name = ir->name;
return backend; return backend;
} }

View file

@ -115,6 +115,11 @@ protected:
*/ */
const string& TypeName() const { return ty_name; } const string& TypeName() const { return ty_name; }
/**
* Sets the name of the backend's type.
*/
void SetTypeName(const string& name) const { ty_name = name; }
private: private:
ReaderBackend* backend; // The backend we have instanatiated. ReaderBackend* backend; // The backend we have instanatiated.
string source; string source;

View file

@ -191,10 +191,10 @@ WriterBackend* Manager::CreateBackend(WriterFrontend* frontend, bro_int_t type)
assert(ld->factory); assert(ld->factory);
frontend->ty_name = ld->name;
WriterBackend* backend = (*ld->factory)(frontend); WriterBackend* backend = (*ld->factory)(frontend);
assert(backend); assert(backend);
frontend->ty_name = ld->name;
return backend; return backend;
} }

View file

@ -80,18 +80,22 @@ const char* BasicThread::Fmt(const char* format, ...)
void BasicThread::Start() void BasicThread::Start()
{ {
if ( started ) if ( started )
return; return;
if ( pthread_mutex_init(&terminate, 0) != 0 ) int err = pthread_mutex_init(&terminate, 0);
reporter->FatalError("Cannot create terminate mutex for thread %s", name.c_str()); if ( err != 0 )
reporter->FatalError("Cannot create terminate mutex for thread %s:%s", name.c_str(), strerror(err));
// We use this like a binary semaphore and acquire it immediately. // We use this like a binary semaphore and acquire it immediately.
if ( pthread_mutex_lock(&terminate) != 0 ) err = pthread_mutex_lock(&terminate);
reporter->FatalError("Cannot aquire terminate mutex for thread %s", name.c_str()); if ( err != 0 )
reporter->FatalError("Cannot aquire terminate mutex for thread %s:%s", name.c_str(), strerror(err));
if ( pthread_create(&pthread, 0, BasicThread::launcher, this) != 0 ) err = pthread_create(&pthread, 0, BasicThread::launcher, this);
reporter->FatalError("Cannot create thread %s", name.c_str()); if ( err != 0 )
reporter->FatalError("Cannot create thread %s:%s", name.c_str(), strerror(err));
DBG_LOG(DBG_THREADING, "Started thread %s", name.c_str()); DBG_LOG(DBG_THREADING, "Started thread %s", name.c_str());