Fix Expression::Extract.

This commit is contained in:
Gunnar Beutner 2013-03-19 14:13:58 +01:00
parent 969458b480
commit 45e24e4729
2 changed files with 10 additions and 8 deletions

View File

@ -220,16 +220,17 @@ void Expression::Extract(const std::vector<String>& path, const ExpressionList::
ASSERT(!path.empty());
if (path[0] == m_Key) {
if (path.size() == 1) {
result->AddExpression(*this);
return;
}
if (!m_Value.IsObjectType<ExpressionList>())
BOOST_THROW_EXCEPTION(std::invalid_argument("Specified path does not exist."));
ExpressionList::Ptr exprl = m_Value;
if (path.size() == 1) {
result->AddExpression(Expression("", OperatorExecute, exprl, m_DebugInfo));
return;
}
std::vector<String> sub_path(path.begin() + 1, path.end());
exprl->Extract(sub_path, result);
} else if (m_Operator == OperatorExecute) {

View File

@ -643,6 +643,8 @@ void Service::BeginExecuteCheck(const boost::function<void (void)>& callback)
{
ASSERT(!OwnsLock());
bool reachable = IsReachable();
{
ObjectLock olock(this);
@ -660,10 +662,9 @@ void Service::BeginExecuteCheck(const boost::function<void (void)>& callback)
SetLastState(GetState());
SetLastStateType(GetLastStateType());
SetLastReachable(reachable);
}
SetLastReachable(IsReachable());
/* keep track of scheduling info in case the check type doesn't provide its own information */
Dictionary::Ptr checkInfo = boost::make_shared<Dictionary>();
checkInfo->Set("schedule_start", GetNextCheck());