MXS-2122: Close listener socket on destruction

Even though directly closing the socket is not very neat in the
architectural sense of things, it allows the best of both worlds: the
socket is instantly closed and is open for reuse while the listener struct
is still available as a reference.

This change needs to be revised when the listeners are refactored into
separate objects.

Updated documentation to reflect the change in behavior.
This commit is contained in:
Markus Mäkelä
2018-10-29 16:05:04 +02:00
parent 47d2898818
commit cd92b6d4d7
6 changed files with 20 additions and 19 deletions

View File

@ -1274,6 +1274,11 @@ void dcb_final_close(DCB* dcb)
}
}
}
else
{
// Only listeners are closed with a fd of -1
mxb_assert(dcb->dcb_role == DCB_ROLE_SERVICE_LISTENER);
}
dcb->state = DCB_STATE_DISCONNECTED;
dcb_remove_from_list(dcb);