CheckTimeView& idx = boost::get<1>(m_IdleServices);
CheckTimeView::iterator it = idx.begin();
- Service::Ptr service = *it;
+ Service::Ptr service = it->lock();
+
+ if (!service) {
+ idx.erase(it);
+ continue;
+ }
if (service->GetNextCheck() > now)
break;
typedef nth_index<ServiceSet, 1>::type CheckTimeView;
CheckTimeView& idx = boost::get<1>(m_IdleServices);
- CheckTimeView::iterator it = idx.begin();
- Service::Ptr service = *it;
+ Service::Ptr service;
+
+ do {
+ CheckTimeView::iterator it = idx.begin();
+
+ if (it == idx.end())
+ return;
+
+ service = it->lock();
+
+ if (!service)
+ idx.erase(it);
+ } while (!service);
m_CheckTimer->Reschedule(service->GetNextCheck());
}
{
typedef double result_type;
- double operator()(const Service::Ptr& service)
+ double operator()(const Service::WeakPtr& wservice)
{
+ Service::Ptr service = wservice.lock();
+
+ if (!service)
+ return 0;
+
return service->GetNextCheck();
}
};
typedef weak_ptr<CheckerComponent> WeakPtr;
typedef multi_index_container<
- Service::Ptr,
+ Service::WeakPtr,
indexed_by<
- ordered_unique<identity<Service::Ptr> >,
+ ordered_unique<identity<Service::WeakPtr> >,
ordered_non_unique<ServiceNextCheckExtractor>
>
> ServiceSet;