session.c:session_free:if session is child of another service (tee in this case), it is the parent which releases child's allocated memory back to the system. This now also includes the child router session. dcb.h: Added DCB_IS_CLONE macro tee.c:freeSession:if parent session triggered closing of tee, then child session may not be closed yet. In that case free the child session first and only then free child router session and release child session's memory back to system. tee.c:routeQuery: only route if child session is ready for routing. Log if session is not ready for routing and set tee session inactive mysql_client.c:gw_client_close:if DCB is cloned one don't close the protocol because they it is shared with the original DCB.
This commit is contained in:
@ -310,7 +310,7 @@ DCB *clone;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
clone->fd = DCBFD_CLONED;;
|
||||
clone->fd = DCBFD_CLOSED;
|
||||
clone->flags |= DCBF_CLONE;
|
||||
clone->state = orig->state;
|
||||
clone->data = orig->data;
|
||||
@ -321,11 +321,10 @@ DCB *clone;
|
||||
clone->protocol = orig->protocol;
|
||||
|
||||
clone->func.write = dcb_null_write;
|
||||
#if 1
|
||||
/**
|
||||
* Close triggers closing of router session as well which is needed.
|
||||
*/
|
||||
clone->func.close = orig->func.close;
|
||||
#else
|
||||
clone->func.close = dcb_null_close;
|
||||
#endif
|
||||
clone->func.auth = dcb_null_auth;
|
||||
|
||||
return clone;
|
||||
|
||||
@ -357,7 +357,6 @@ bool session_free(
|
||||
int i;
|
||||
|
||||
CHK_SESSION(session);
|
||||
|
||||
/*<
|
||||
* Remove one reference. If there are no references left,
|
||||
* free session.
|
||||
@ -389,14 +388,14 @@ bool session_free(
|
||||
atomic_add(&session->service->stats.n_current, -1);
|
||||
|
||||
/**
|
||||
* Free router_session and set it NULL
|
||||
* If session is not child of some other session, free router_session.
|
||||
* Otherwise let the parent free it.
|
||||
*/
|
||||
if (session->router_session)
|
||||
if (!session->ses_is_child && session->router_session)
|
||||
{
|
||||
session->service->router->freeSession(
|
||||
session->service->router_instance,
|
||||
session->router_session);
|
||||
session->router_session = NULL;
|
||||
}
|
||||
if (session->n_filters)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user