Add better error messaging when RegisterFd/UnregisterFd fail

This commit is contained in:
Tim Wojtulewicz 2020-01-30 13:34:10 -07:00
parent 0cfb115c1b
commit fea0339aca
6 changed files with 39 additions and 19 deletions

View file

@ -181,7 +181,8 @@ MsgThread::MsgThread() : BasicThread(), queue_in(this, 0), queue_out(0, this)
failed = false;
thread_mgr->AddMsgThread(this);
iosource_mgr->RegisterFd(flare.FD(), this);
if ( ! iosource_mgr->RegisterFd(flare.FD(), this) )
reporter->FatalError("Failed to register MsgThread fd with iosource_mgr");
SetClosed(false);
}
@ -190,7 +191,7 @@ MsgThread::~MsgThread()
{
// Unregister this thread from the iosource manager so it doesn't wake
// up the main poll anymore.
iosource_mgr->UnregisterFd(flare.FD());
iosource_mgr->UnregisterFd(flare.FD(), this);
}
// Set by Bro's main signal handler.