Check return values of SymGetLineFromAddr64 and SymFromAddr.

This commit is contained in:
Gunnar Beutner 2013-03-07 16:00:10 +01:00
parent 4595e4ce5f
commit e2416b5b54
37 changed files with 130 additions and 110 deletions

View File

@ -328,7 +328,7 @@ void CompatComponent::DumpHostObject(ostream& fp, const Host::Ptr& host)
void CompatComponent::DumpServiceStatusAttrs(ostream& fp, const Service::Ptr& service, CompatObjectType type)
{
assert(service->OwnsLock());
ASSERT(service->OwnsLock());
String output;
String perfdata;

View File

@ -195,7 +195,7 @@ void DelegationComponent::DelegationTimerHandler(void)
continue;
}
assert(!service->GetCurrentChecker().IsEmpty());
ASSERT(!service->GetCurrentChecker().IsEmpty());
}
Endpoint::Ptr endpoint;

View File

@ -97,7 +97,7 @@ static void ReloadConfigTimerHandler(void)
static void SigHupHandler(int signum)
{
assert(signum == SIGHUP);
ASSERT(signum == SIGHUP);
g_ReloadConfig = true;
}

View File

@ -77,6 +77,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "remoting", "lib\remoting\re
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcxproj", "{5163C576-6AA1-4769-8396-9639C45BE124}"
ProjectSection(ProjectDependencies) = postProject
{BE412865-FEBA-4259-AD41-58950D1F5432} = {BE412865-FEBA-4259-AD41-58950D1F5432}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -54,7 +54,7 @@ Application::Application(const Dictionary::Ptr& serializedUpdate)
m_Debugging = true;
#endif /* _WIN32 */
assert(m_Instance == NULL);
ASSERT(m_Instance == NULL);
m_Instance = this;
}
@ -284,7 +284,7 @@ void Application::DisplayBugMessage(void)
*/
void Application::SigIntHandler(int signum)
{
assert(signum == SIGINT);
ASSERT(signum == SIGINT);
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
@ -300,13 +300,13 @@ void Application::SigIntHandler(int signum)
}
/**
* Signal handler for SIGABRT. Helps with debugging assert()s.
* Signal handler for SIGABRT. Helps with debugging ASSERT()s.
*
* @param signum The signal number.
*/
void Application::SigAbrtHandler(int signum)
{
assert(signum == SIGABRT);
ASSERT(signum == SIGABRT);
#ifndef _WIN32
struct sigaction sa;
@ -435,7 +435,7 @@ int Application::Run(void)
*/
void Application::UpdatePidFile(const String& filename)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
if (m_PidFile != NULL)
@ -469,7 +469,7 @@ void Application::UpdatePidFile(const String& filename)
*/
void Application::ClosePidFile(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
if (m_PidFile != NULL)

View File

@ -53,9 +53,9 @@ public:
~AsyncTask(void)
{
if (!m_Finished)
assert(!"Contract violation: AsyncTask was destroyed before its completion callback was invoked.");
ASSERT(!"Contract violation: AsyncTask was destroyed before its completion callback was invoked.");
else if (!m_ResultRetrieved)
assert(!"Contract violation: AsyncTask was destroyed before its result was retrieved.");
ASSERT(!"Contract violation: AsyncTask was destroyed before its result was retrieved.");
}
@ -67,7 +67,7 @@ public:
*/
void Start(const CompletionCallback& completionCallback = CompletionCallback())
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
boost::mutex::scoped_lock lock(m_Mutex);
m_CompletionCallback = completionCallback;
@ -81,7 +81,7 @@ public:
*/
bool IsFinished(void) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
boost::mutex::scoped_lock lock(m_Mutex);
return m_Finished;
}
@ -95,7 +95,7 @@ public:
*/
TResult GetResult(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
boost::mutex::scoped_lock lock(m_Mutex);
while (!m_Finished)
@ -122,7 +122,7 @@ public:
*/
void FinishException(const boost::exception_ptr& ex)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
boost::mutex::scoped_lock lock(m_Mutex);
m_Exception = ex;
@ -137,7 +137,7 @@ public:
*/
void FinishResult(const TResult& result)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
boost::mutex::scoped_lock lock(m_Mutex);
m_Result = result;
@ -161,7 +161,7 @@ private:
*/
void FinishInternal(void)
{
assert(!m_Finished);
ASSERT(!m_Finished);
m_Finished = true;
m_CV.notify_all();

View File

@ -113,7 +113,7 @@ AttributeHolder::~AttributeHolder(void)
void AttributeHolder::Bind(AttributeBase *boundAttribute)
{
assert(m_OwnsAttribute);
ASSERT(m_OwnsAttribute);
boundAttribute->Set(m_Attribute->Get());
m_Attribute = boundAttribute;
m_OwnsAttribute = false;

View File

@ -70,7 +70,7 @@ Dictionary::Dictionary(void)
*/
Value Dictionary::Get(const char *key) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
map<String, Value>::const_iterator it;
@ -109,10 +109,10 @@ void Dictionary::Set(const String& key, const Value& value)
return;
}
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
assert(!m_Sealed);
ASSERT(!m_Sealed);
pair<map<String, Value>::iterator, bool> ret;
ret = m_Data.insert(make_pair(key, value));
@ -129,7 +129,7 @@ void Dictionary::Set(const String& key, const Value& value)
*/
String Dictionary::Add(const Value& value)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
Dictionary::Iterator it;
@ -159,7 +159,7 @@ String Dictionary::Add(const Value& value)
*/
Dictionary::Iterator Dictionary::Begin(void)
{
assert(OwnsLock());
ASSERT(OwnsLock());
return m_Data.begin();
}
@ -171,7 +171,7 @@ Dictionary::Iterator Dictionary::Begin(void)
*/
Dictionary::Iterator Dictionary::End(void)
{
assert(OwnsLock());
ASSERT(OwnsLock());
return m_Data.end();
}
@ -184,7 +184,7 @@ Dictionary::Iterator Dictionary::End(void)
*/
size_t Dictionary::GetLength(void) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
return m_Data.size();
@ -199,7 +199,7 @@ size_t Dictionary::GetLength(void) const
*/
bool Dictionary::Contains(const String& key) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
return (m_Data.find(key) != m_Data.end());
@ -213,7 +213,7 @@ bool Dictionary::Contains(const String& key) const
*/
void Dictionary::Remove(const String& key)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
Dictionary::Iterator it;
@ -232,7 +232,7 @@ void Dictionary::Remove(const String& key)
*/
void Dictionary::Remove(Dictionary::Iterator it)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
String key = it->first;
@ -245,7 +245,7 @@ void Dictionary::Remove(Dictionary::Iterator it)
*/
void Dictionary::Seal(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
m_Sealed = true;
@ -258,7 +258,7 @@ void Dictionary::Seal(void)
*/
bool Dictionary::IsSealed(void) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
return m_Sealed;
@ -272,7 +272,7 @@ bool Dictionary::IsSealed(void) const
*/
Dictionary::Ptr Dictionary::ShallowClone(void) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
Dictionary::Ptr clone = boost::make_shared<Dictionary>();

View File

@ -121,7 +121,7 @@ void DynamicObject::ApplyUpdate(const Dictionary::Ptr& serializedUpdate,
{
ObjectLock olock(this);
assert(serializedUpdate->IsSealed());
ASSERT(serializedUpdate->IsSealed());
Value configTxValue = serializedUpdate->Get("configTx");
@ -143,7 +143,7 @@ void DynamicObject::ApplyUpdate(const Dictionary::Ptr& serializedUpdate,
Dictionary::Ptr attrs = serializedUpdate->Get("attrs");
assert(attrs->IsSealed());
ASSERT(attrs->IsSealed());
{
ObjectLock alock(attrs);
@ -155,7 +155,7 @@ void DynamicObject::ApplyUpdate(const Dictionary::Ptr& serializedUpdate,
Dictionary::Ptr attr = it->second;
assert(attr->IsSealed());
ASSERT(attr->IsSealed());
int type = attr->Get("type");
@ -179,7 +179,7 @@ void DynamicObject::ApplyUpdate(const Dictionary::Ptr& serializedUpdate,
void DynamicObject::RegisterAttribute(const String& name,
AttributeType type, AttributeBase *boundAttribute)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
boost::mutex::scoped_lock lock(m_AttributeMutex);
@ -193,7 +193,7 @@ void DynamicObject::RegisterAttribute(const String& name,
void DynamicObject::InternalRegisterAttribute(const String& name,
AttributeType type, AttributeBase *boundAttribute)
{
assert(OwnsLock());
ASSERT(OwnsLock());
AttributeHolder attr(type, boundAttribute);
@ -213,7 +213,7 @@ void DynamicObject::InternalRegisterAttribute(const String& name,
*/
void DynamicObject::Set(const String& name, const Value& data)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
boost::mutex::scoped_lock lock(m_AttributeMutex);
@ -226,7 +226,7 @@ void DynamicObject::Set(const String& name, const Value& data)
*/
void DynamicObject::Touch(const String& name)
{
assert(OwnsLock());
ASSERT(OwnsLock());
boost::mutex::scoped_lock lock(m_AttributeMutex);
@ -250,7 +250,7 @@ void DynamicObject::Touch(const String& name)
*/
Value DynamicObject::Get(const String& name) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
boost::mutex::scoped_lock lock(m_AttributeMutex);
@ -264,7 +264,7 @@ Value DynamicObject::Get(const String& name) const
void DynamicObject::InternalSetAttribute(const String& name, const Value& data,
double tx, bool allowEditConfig)
{
assert(OwnsLock());
ASSERT(OwnsLock());
DynamicObject::AttributeIterator it;
it = m_Attributes.find(name);
@ -304,7 +304,7 @@ void DynamicObject::InternalSetAttribute(const String& name, const Value& data,
*/
Value DynamicObject::InternalGetAttribute(const String& name) const
{
assert(OwnsLock());
ASSERT(OwnsLock());
DynamicObject::AttributeConstIterator it;
it = m_Attributes.find(name);
@ -375,7 +375,7 @@ String DynamicObject::GetSource(void) const
void DynamicObject::Register(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
/* Add this new object to the list of modified objects.
* We're doing this here because we can't construct
@ -391,7 +391,7 @@ void DynamicObject::Register(void)
void DynamicObject::OnRegistrationCompleted(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
Start();
@ -400,21 +400,21 @@ void DynamicObject::OnRegistrationCompleted(void)
void DynamicObject::OnUnregistrationCompleted(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
OnUnregistered(GetSelf());
}
void DynamicObject::Start(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
/* Nothing to do here. */
}
void DynamicObject::Unregister(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
DynamicType::Ptr dtype = GetType();
@ -524,7 +524,7 @@ void DynamicObject::RestoreObjects(const String& filename)
while (NetString::ReadStringFromStream(sfp, &message)) {
Dictionary::Ptr persistentObject = Value::Deserialize(message);
assert(persistentObject->IsSealed());
ASSERT(persistentObject->IsSealed());
String type = persistentObject->Get("type");
String name = persistentObject->Get("name");
@ -624,7 +624,7 @@ void DynamicObject::NewTx(void)
void DynamicObject::OnAttributeChanged(const String&)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
}
/*
@ -638,7 +638,7 @@ DynamicObject::Ptr DynamicObject::GetObject(const String& type, const String& na
const DynamicObject::AttributeMap& DynamicObject::GetAttributes(void) const
{
assert(OwnsLock());
ASSERT(OwnsLock());
return m_Attributes;
}

View File

@ -152,7 +152,7 @@ void DynamicType::RegisterType(const DynamicType::Ptr& type)
DynamicObject::Ptr DynamicType::CreateObject(const Dictionary::Ptr& serializedUpdate)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectFactory factory;

View File

@ -118,7 +118,7 @@ size_t FIFO::GetAvailableBytes(void) const
*/
size_t FIFO::Peek(void *buffer, size_t count)
{
assert(IsConnected());
ASSERT(IsConnected());
if (count > m_DataSize)
count = m_DataSize;
@ -149,7 +149,7 @@ size_t FIFO::Read(void *buffer, size_t count)
*/
void FIFO::Write(const void *buffer, size_t count)
{
assert(IsConnected());
ASSERT(IsConnected());
ResizeBuffer(m_Offset + m_DataSize + count);
memcpy(m_Buffer + m_Offset + m_DataSize, buffer, count);

View File

@ -66,7 +66,7 @@ public:
{
#ifdef _DEBUG
shared_ptr<T> other = dynamic_pointer_cast<T>(m_Object);
assert(other);
ASSERT(other);
#else /* _DEBUG */
shared_ptr<T> other = static_pointer_cast<T>(m_Object);
#endif /* _DEBUG */

View File

@ -46,8 +46,8 @@ ObjectLock::ObjectLock(const Object *object)
void ObjectLock::Lock(void)
{
assert(!m_Lock.owns_lock() && m_Object != NULL);
assert(!m_Object->OwnsLock());
ASSERT(!m_Lock.owns_lock() && m_Object != NULL);
ASSERT(!m_Object->OwnsLock());
m_Lock = Object::MutexType::scoped_lock(m_Object->m_Mutex);

View File

@ -128,7 +128,7 @@ void Process::WorkerThreadProc(int taskFd)
/* Read one byte for every task we take from the pending tasks list. */
char buffer[MaxTasksPerThread];
assert(want <= sizeof(buffer));
ASSERT(want <= sizeof(buffer));
int have = read(taskFd, &buffer, want);
@ -140,7 +140,7 @@ void Process::WorkerThreadProc(int taskFd)
}
while (have > 0) {
assert(!m_Tasks.empty());
ASSERT(!m_Tasks.empty());
Process::Ptr task = m_Tasks.front();
m_Tasks.pop_front();
@ -209,7 +209,7 @@ void Process::InitTask(void)
{
m_Result.ExecutionStart = Utility::GetTime();
assert(m_FD == -1);
ASSERT(m_FD == -1);
int fds[2];

View File

@ -50,8 +50,8 @@ void Socket::Start(void)
{
ObjectLock olock(this);
assert(!m_ReadThread.joinable() && !m_WriteThread.joinable());
assert(GetFD() != INVALID_SOCKET);
ASSERT(!m_ReadThread.joinable() && !m_WriteThread.joinable());
ASSERT(GetFD() != INVALID_SOCKET);
// TODO: figure out why we're not using "this" here
m_ReadThread = thread(boost::bind(&Socket::ReadThreadProc, static_cast<Socket::Ptr>(GetSelf())));

View File

@ -152,10 +152,21 @@ void StackTrace::Print(ostream& fp, int ignoreFrames)
IMAGEHLP_LINE64 line;
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
(void) SymGetLineFromAddr64(GetCurrentProcess(), dwAddress, &dwDisplacement, &line);
(void) SymFromAddr(GetCurrentProcess(), dwAddress, &dwDisplacement64, pSymbol);
fp << "\t(" << i - ignoreFrames - 1 << ") ";
if (SymGetLineFromAddr64(GetCurrentProcess(), dwAddress, &dwDisplacement, &line))
fp << line.FileName << ":" << line.LineNumber;
else
fp << "(unknown file/line)";
fp << "\t(" << i - ignoreFrames - 1 << ") " << line.FileName << ":" << line.LineNumber << ": " << pSymbol->Name << "+" << dwDisplacement64 << std::endl;
fp << ": ";
if (SymFromAddr(GetCurrentProcess(), dwAddress, &dwDisplacement64, pSymbol))
fp << pSymbol->Name << "+" << dwDisplacement64;
else
fp << "(unknown function)";
fp << std::endl;
}
#endif /* _WIN32 */
}

View File

@ -27,7 +27,7 @@ Stream::Stream(void)
Stream::~Stream(void)
{
assert(!m_Running);
ASSERT(!m_Running);
}
/**
@ -106,7 +106,7 @@ void Stream::Close(void)
{
ObjectLock olock(this);
assert(m_Running);
ASSERT(m_Running);
m_Running = false;
}

View File

@ -45,7 +45,7 @@ void SyslogLogger::ProcessLogEntry(const LogEntry& entry)
severity = LOG_CRIT;
break;
default:
assert(!"Invalid severity specified.");
ASSERT(!"Invalid severity specified.");
}
syslog(severity | LOG_USER, "%s", entry.Message.CStr());

View File

@ -88,7 +88,7 @@ void Timer::Uninitialize(void)
*/
void Timer::Call(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
Timer::Ptr self = GetSelf();
@ -105,7 +105,7 @@ void Timer::Call(void)
*/
void Timer::SetInterval(double interval)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
boost::mutex::scoped_lock lock(m_Mutex);
m_Interval = interval;
@ -119,7 +119,7 @@ void Timer::SetInterval(double interval)
*/
double Timer::GetInterval(void) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
boost::mutex::scoped_lock lock(m_Mutex);
return m_Interval;
@ -132,7 +132,7 @@ double Timer::GetInterval(void) const
*/
void Timer::Start(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
{
boost::mutex::scoped_lock lock(m_Mutex);
@ -149,7 +149,7 @@ void Timer::Start(void)
*/
void Timer::Stop(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
boost::mutex::scoped_lock lock(m_Mutex);
@ -169,7 +169,7 @@ void Timer::Stop(void)
*/
void Timer::Reschedule(double next)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
boost::mutex::scoped_lock lock(m_Mutex);
@ -196,7 +196,7 @@ void Timer::Reschedule(double next)
*/
double Timer::GetNext(void) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
boost::mutex::scoped_lock lock(m_Mutex);
return m_Next;

View File

@ -131,7 +131,7 @@ void TlsStream::ClosedHandler(void)
*/
void TlsStream::HandleIO(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
char data[16 * 1024];

View File

@ -86,4 +86,10 @@ private:
}
#ifdef _DEBUG
# define ASSERT(expr) ASSERT(expr)
#else /* _DEBUG */
# define ASSERT(expr)
#endif /* _DEBUG */
#endif /* UTILITY_H */

View File

@ -257,7 +257,7 @@ static ConfigType::Ptr m_Type;
void ConfigCompiler::Compile(void)
{
assert(ConfigCompilerContext::GetContext() != NULL);
ASSERT(ConfigCompilerContext::GetContext() != NULL);
try {
yyparse(this);

View File

@ -104,7 +104,7 @@ static ConfigType::Ptr m_Type;
void ConfigCompiler::Compile(void)
{
assert(ConfigCompilerContext::GetContext() != NULL);
ASSERT(ConfigCompilerContext::GetContext() != NULL);
try {
yyparse(this);

View File

@ -91,7 +91,7 @@ int ConfigCompilerContext::GetFlags(void) const
void ConfigCompilerContext::SetContext(ConfigCompilerContext *context)
{
assert(m_Context == NULL || context == NULL);
ASSERT(m_Context == NULL || context == NULL);
m_Context = context;
}
@ -131,7 +131,7 @@ void ConfigCompilerContext::Validate(void)
void ConfigCompilerContext::ActivateItems(void)
{
assert(m_Context == NULL);
ASSERT(m_Context == NULL);
Logger::Write(LogInformation, "config", "Activating config items in compilation unit '" + m_Unit + "'");
BOOST_FOREACH(const ConfigItem::Ptr& item, m_Items) {

View File

@ -155,7 +155,7 @@ void ConfigItem::InternalLink(const Dictionary::Ptr& dictionary) const
*/
DynamicObject::Ptr ConfigItem::Commit(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
String type, name;
@ -290,7 +290,7 @@ DynamicObject::Ptr ConfigItem::Commit(void)
*/
void ConfigItem::Unregister(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
DynamicObject::Ptr dobj = m_DynamicObject.lock();
@ -314,7 +314,7 @@ void ConfigItem::Unregister(void)
void ConfigItem::UnregisterFromParents(void)
{
assert(OwnsLock());
ASSERT(OwnsLock());
BOOST_FOREACH(const String& parentName, m_Parents) {
ConfigItem::Ptr parent = GetObject(GetType(), parentName);
@ -329,7 +329,7 @@ void ConfigItem::UnregisterFromParents(void)
*/
void ConfigItem::OnParentCommitted(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ConfigItem::Ptr self = GetSelf();

View File

@ -63,7 +63,7 @@ bool TypeRule::MatchValue(const Value& value) const
return value.IsObjectType<Dictionary>();
default:
assert(!"Type rule has invalid type specifier.");
ASSERT(!"Type rule has invalid type specifier.");
return false;
}

View File

@ -56,7 +56,7 @@ Host::~Host(void)
void Host::OnRegistrationCompleted(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
DynamicObject::OnRegistrationCompleted();
@ -109,7 +109,7 @@ String Host::GetHostCheck(void) const
bool Host::IsReachable(void) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
set<Service::Ptr> parentServices = GetParentServices();
@ -204,7 +204,7 @@ static void CopyServiceAttributes(TDict serviceDesc, const ConfigItemBuilder::Pt
void Host::UpdateSlaveServices(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
ConfigItem::Ptr item = ConfigItem::GetObject("Host", GetName());
@ -289,7 +289,7 @@ void Host::UpdateSlaveServices(void)
void Host::OnAttributeChanged(const String& name)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
if (name == "hostgroups")
HostGroup::InvalidateMembersCache();
@ -434,7 +434,7 @@ Service::Ptr Host::GetServiceByShortName(const Value& name) const
if (it != services.end()) {
Service::Ptr service = it->second.lock();
assert(service);
ASSERT(service);
return service;
}
}
@ -444,7 +444,7 @@ Service::Ptr Host::GetServiceByShortName(const Value& name) const
Dictionary::Ptr dict = name;
String short_name;
assert(dict->IsSealed());
ASSERT(dict->IsSealed());
return Service::GetByNamePair(dict->Get("host"), dict->Get("service"));
} else {
@ -537,7 +537,7 @@ StateType Host::GetStateType(void) const
HostState Host::GetLastState(void) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
if (!IsReachable())
return HostUnreachable;
@ -582,7 +582,7 @@ String Host::HostStateToString(HostState state)
Dictionary::Ptr Host::CalculateDynamicMacros(void) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
Dictionary::Ptr macros = boost::make_shared<Dictionary>();

View File

@ -46,7 +46,7 @@ HostGroup::~HostGroup(void)
*/
void HostGroup::OnRegistrationCompleted(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
InvalidateMembersCache();
}

View File

@ -90,7 +90,7 @@ int IcingaApplication::Main(void)
*/
void IcingaApplication::OnShutdown(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
{
ObjectLock olock(this);

View File

@ -28,7 +28,7 @@ Value MacroProcessor::ResolveMacros(const Value& cmd, const Dictionary::Ptr& mac
{
Value result;
assert(macros->IsSealed());
ASSERT(macros->IsSealed());
if (cmd.IsScalar()) {
result = InternalResolveMacros(cmd, macros);

View File

@ -163,7 +163,7 @@ String Notification::NotificationTypeToString(NotificationType type)
*/
void Notification::BeginExecuteNotification(NotificationType type, const Dictionary::Ptr& cr)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
Dictionary::Ptr macros = cr->Get("macros");
@ -193,7 +193,7 @@ void Notification::BeginExecuteNotification(NotificationType type, const Diction
*/
void Notification::BeginExecuteNotificationHelper(const Dictionary::Ptr& notificationMacros, NotificationType type, const User::Ptr& user)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
vector<Dictionary::Ptr> macroDicts;
@ -237,7 +237,7 @@ void Notification::BeginExecuteNotificationHelper(const Dictionary::Ptr& notific
*/
void Notification::NotificationCompletedHandler(const ScriptTask::Ptr& task)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
{
ObjectLock olock(this);
@ -264,7 +264,7 @@ void Notification::NotificationCompletedHandler(const ScriptTask::Ptr& task)
*/
void Notification::OnAttributeChanged(const String& name)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
if (name == "host_name" || name == "service")
Service::InvalidateNotificationsCache();

View File

@ -373,7 +373,7 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
{
bool reachable = IsReachable();
assert(!OwnsLock());
ASSERT(!OwnsLock());
ObjectLock olock(this);
ServiceState old_state = GetState();
@ -571,7 +571,7 @@ bool Service::IsAllowedChecker(const String& checker) const
*/
void Service::BeginExecuteCheck(const function<void (void)>& callback)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
{
ObjectLock olock(this);
@ -619,7 +619,7 @@ void Service::BeginExecuteCheck(const function<void (void)>& callback)
void Service::CheckCompletedHandler(const Dictionary::Ptr& checkInfo,
const ScriptTask::Ptr& task, const function<void (void)>& callback)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
checkInfo->Set("execution_end", Utility::GetTime());
checkInfo->Set("schedule_end", Utility::GetTime());

View File

@ -83,7 +83,7 @@ Service::~Service(void)
*/
void Service::OnRegistrationCompleted(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
DynamicObject::OnRegistrationCompleted();
@ -192,7 +192,7 @@ String Service::GetShortName(void) const
*/
bool Service::IsReachable(void) const
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
BOOST_FOREACH(const Service::Ptr& service, GetParentServices()) {
/* ignore ourselves */
@ -249,7 +249,7 @@ bool Service::IsReachable(void) const
*/
AcknowledgementType Service::GetAcknowledgement(void)
{
assert(OwnsLock());
ASSERT(OwnsLock());
if (m_Acknowledgement.IsEmpty())
return AcknowledgementNone;
@ -336,7 +336,7 @@ void Service::ClearAcknowledgement(void)
*/
void Service::OnAttributeChanged(const String& name)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
Service::Ptr self = GetSelf();
@ -454,7 +454,7 @@ Dictionary::Ptr Service::CalculateDynamicMacros(void) const
}
if (cr) {
assert(cr->IsSealed());
ASSERT(cr->IsSealed());
macros->Set("SERVICELATENCY", Service::CalculateLatency(cr));
macros->Set("SERVICEEXECUTIONTIME", Service::CalculateExecutionTime(cr));

View File

@ -46,7 +46,7 @@ ServiceGroup::~ServiceGroup(void)
*/
void ServiceGroup::OnRegistrationCompleted(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
InvalidateMembersCache();
}

View File

@ -41,7 +41,7 @@ User::~User(void)
*/
void User::OnAttributeChanged(const String& name)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
if (name == "groups")
UserGroup::InvalidateMembersCache();

View File

@ -44,7 +44,7 @@ UserGroup::~UserGroup(void)
*/
void UserGroup::OnRegistrationCompleted(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
InvalidateMembersCache();
}

View File

@ -294,7 +294,7 @@ void Endpoint::NewMessageHandler(const MessagePart& message)
void Endpoint::ClientClosedHandler(void)
{
assert(!OwnsLock());
ASSERT(!OwnsLock());
/*try {
GetClient()->CheckException();