Destroy monitor only if it's not used
If a service uses a monitor as the source of its servers, it must not be destroyed before the monitor is removed from all services that use it.
This commit is contained in:
@ -840,6 +840,21 @@ Service* service_internal_find(const char* name)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Service* service_uses_monitor(mxs::Monitor* monitor)
|
||||
{
|
||||
LockGuard guard(this_unit.lock);
|
||||
|
||||
for (Service* s : this_unit.services)
|
||||
{
|
||||
if (s->m_monitor == monitor)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a named service
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user