Make server creation simpler

Server creation and allocation are now the same apart from the fact that
allocation only adds the server to the running configuration where as the
creation of a server also persist it to disk.

The server serialization should not be seen through the server.h API. This
allows the serialization method to change without actually having to
change the interfaces.
This commit is contained in:
Markus Makela
2016-11-11 10:13:14 +02:00
parent 16e8aa7178
commit 08ebb88aec
7 changed files with 174 additions and 119 deletions

View File

@ -2730,11 +2730,7 @@ int create_new_server(CONFIG_CONTEXT *obj)
if (address && port && protocol)
{
if ((obj->element = server_alloc(address, protocol, atoi(port), auth, auth_opts)))
{
server_set_unique_name(obj->element, obj->object);
}
else
if ((obj->element = server_alloc(obj->object, address, atoi(port), protocol, auth, auth_opts)) == NULL)
{
MXS_ERROR("Failed to create a new server, memory allocation failed.");
error_count++;