MXS-1689 Properly check for duplicate port/socket of service

It is now impossible to create two listeners for a service that
would listen on the same port/socket (as before), but the error
message is now sensible and provides detailed information to the
user.
This commit is contained in:
Johan Wikman
2018-03-07 13:02:12 +02:00
parent ff9024bdfb
commit 7ae3931511
3 changed files with 71 additions and 8 deletions

View File

@ -236,6 +236,24 @@ bool serviceAddBackend(SERVICE *service, SERVER *server);
*/
bool serviceHasBackend(SERVICE *service, SERVER *server);
/**
* @brief Find listener with specified properties.
*
* @param service Service to check
* @param socket Listener socket path
* @param address Listener address
* @param port Listener port number
*
* @note Either socket should be NULL and port non-zero or socket
* non-NULL and port zero.
*
* @return True if service has the listener
*/
SERV_LISTENER* service_find_listener(SERVICE* service,
const char* socket,
const char* address,
unsigned short port);
/**
* @brief Check if a service has a listener
*