No errors were logged when a service has no listeners

The starting of a service without listeners would fail but there wouldn't be
any log messages about the reason of the failure. In addition to this, MaxScale
would try to restart the service periodically which would lead to unnecessary
error messages.

With this change, missing listeners for services are considered configuration
errors.
This commit is contained in:
Markus Makela
2016-03-03 15:57:08 +02:00
parent 0ddb81ea16
commit cb8ea84853
3 changed files with 32 additions and 1 deletions

View File

@ -2249,3 +2249,28 @@ static void service_internal_restart(void *data)
SERVICE* service = (SERVICE*)data;
serviceStartAllPorts(service);
}
/**
* Check that all services have listeners
* @return True if all services have listeners
*/
bool service_all_services_have_listeners()
{
bool rval = true;
spinlock_acquire(&service_spin);
SERVICE* service = allServices;
while (service)
{
if (service->ports == NULL)
{
MXS_ERROR("Service '%s' has no listeners.", service->name);
rval = false;
}
service = service->next;
}
spinlock_release(&service_spin);
return rval;
}