MXS-2196: Store listener reference in DCB

By storing the reference in the DCB, the two-way dependency between the
listeners and services is severed. Now the services have no direct link to
listeners and after the destruction of a listener it will be freed once
all connections through it have closed.

Due to the fact that a listener itself has a DCB that must point to a
valid listener, a self-reference is stored in the listener DCB. This is
extremely confusing and is only here to keep the code functional until the
DCB part of the listener can be factored out.
This commit is contained in:
Markus Mäkelä
2018-11-30 17:48:32 +02:00
parent 7a87ff9ce1
commit 45827dd433
12 changed files with 39 additions and 71 deletions

View File

@ -263,7 +263,7 @@ static int cdc_auth_authenticate(DCB* dcb)
cdc_auth_check(dcb, protocol, client_data->user, client_data->auth_data, client_data->flags);
/* On failed authentication try to reload users and authenticate again */
if (CDC_STATE_AUTH_OK != auth_ret && cdc_replace_users(dcb->listener) == MXS_AUTH_LOADUSERS_OK)
if (CDC_STATE_AUTH_OK != auth_ret && cdc_replace_users(dcb->listener.get()) == MXS_AUTH_LOADUSERS_OK)
{
auth_ret = cdc_auth_check(dcb,
protocol,