Fix duplicate listener checks

Only the protocol, port and address of the listener were used to check if
a listener exists. The check should also use the name of the listener to
be sure that each name is unique.

Expanded tests to check that the creation of duplicate listeners is
detected. Did minor improvements to related test code.
This commit is contained in:
Markus Mäkelä
2017-08-07 15:47:16 +03:00
parent c593a1bf32
commit c2a2688b93
8 changed files with 71 additions and 29 deletions

View File

@ -743,7 +743,7 @@ bool runtime_create_listener(SERVICE *service, const char *name, const char *add
spinlock_acquire(&crt_lock);
if (!serviceHasListener(service, proto, addr, u_port))
if (!serviceHasListener(service, name, proto, addr, u_port))
{
SSL_LISTENER *ssl = NULL;
@ -807,10 +807,8 @@ bool runtime_destroy_listener(SERVICE *service, const char *name)
}
else
{
rval = false;
MXS_WARNING("Listener '%s' was not created at runtime. Remove the "
"listener manually from the correct configuration file.",
name);
runtime_error("Listener '%s' was not created at runtime. Remove the listener "
"manually from the correct configuration file.", name);
}
}
else