MXS-2196: Store listener references in Service
By storing a shared pointer to the listeners in the services, they will be available as long as the service using them exists. This enables clean destruction of listeners that still have open sessions. The listener creation code now separately creates the listener and links it to the service. Also replaced relevant parts of the related code with the listener implemented versions of it.
This commit is contained in:
@ -3887,28 +3887,18 @@ int create_new_listener(CONFIG_CONTEXT* obj)
|
||||
// authenticators that are specific to each protocol module
|
||||
char* authenticator = config_get_value(obj->parameters, CN_AUTHENTICATOR);
|
||||
char* authenticator_options = config_get_value(obj->parameters, CN_AUTHENTICATOR_OPTIONS);
|
||||
int net_port = socket ? 0 : atoi(port);
|
||||
|
||||
if (socket)
|
||||
auto listener = Listener::create(service, obj->object, protocol, socket ? socket : address,
|
||||
net_port, authenticator, authenticator_options, ssl_info);
|
||||
|
||||
if (listener)
|
||||
{
|
||||
listener_alloc(service,
|
||||
obj->object,
|
||||
protocol,
|
||||
socket,
|
||||
0,
|
||||
authenticator,
|
||||
authenticator_options,
|
||||
ssl_info);
|
||||
service->add_listener(listener);
|
||||
}
|
||||
else if (port)
|
||||
else
|
||||
{
|
||||
listener_alloc(service,
|
||||
obj->object,
|
||||
protocol,
|
||||
address,
|
||||
atoi(port),
|
||||
authenticator,
|
||||
authenticator_options,
|
||||
ssl_info);
|
||||
++error_count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user