diff --git a/server/core/config.c b/server/core/config.c index 79a185c3e..c5fbb4e5c 100644 --- a/server/core/config.c +++ b/server/core/config.c @@ -570,9 +570,14 @@ process_config_context(CONFIG_CONTEXT *context) * error_count += consistency_checks(); */ + if (!service_all_services_have_listeners()) + { + error_count++; + } + if (error_count) { - MXS_ERROR("%d errors where encountered processing the configuration " + MXS_ERROR("%d errors were encountered while processing the configuration " "file '%s'.", error_count, config_file); return 0; } diff --git a/server/core/service.c b/server/core/service.c index b741edc81..7eab44d50 100644 --- a/server/core/service.c +++ b/server/core/service.c @@ -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; +} diff --git a/server/include/service.h b/server/include/service.h index db9d76ad0..05ccf74ec 100644 --- a/server/include/service.h +++ b/server/include/service.h @@ -264,5 +264,6 @@ extern void service_shutdown(); extern int serviceSessionCountAll(); extern RESULTSET *serviceGetList(); extern RESULTSET *serviceGetListenerList(); +extern bool service_all_services_have_listeners(); #endif