Various changes to block loopholes in different cases and tidy up.

This commit is contained in:
counterpoint
2015-09-21 09:23:22 +01:00
parent b8af047a25
commit 88716c35fb
5 changed files with 122 additions and 63 deletions

View File

@ -886,7 +886,7 @@ static void handleError(
spinlock_release(&session->ses_lock);
}
if (router_cli_ses->backend_dcb) {
if (router_cli_ses && router_cli_ses->backend_dcb) {
if (backend_dcb != router_cli_ses->backend_dcb)
{
/* Linkages have gone badly wrong */
@ -898,9 +898,9 @@ static void handleError(
backend_dcb)));
}
router_cli_ses->backend_dcb = NULL;
dcb_close(backend_dcb);
}
dcb_close(backend_dcb);
/** false because connection is not available anymore */
*succp = false;
}

View File

@ -990,7 +990,7 @@ static void closeSession(
int i;
/**
* This sets router closed. Nobody is allowed to use router
* whithout checking this first.
* without checking this first.
*/
router_cli_ses->rses_closed = true;
@ -5306,8 +5306,6 @@ static int router_handle_state_switch(
backend_ref_t* bref;
int rc = 1;
SERVER* srv;
ROUTER_CLIENT_SES* rses;
SESSION* ses;
CHK_DCB(dcb);
bref = (backend_ref_t *)data;
CHK_BACKEND_REF(bref);
@ -5327,7 +5325,10 @@ static int router_handle_state_switch(
srv->port,
STRSRVSTATUS(srv))));
CHK_SESSION(((SESSION*)dcb->session));
CHK_CLIENT_RSES(((ROUTER_CLIENT_SES *)dcb->session->router_session));
if (dcb->session->router_session)
{
CHK_CLIENT_RSES(((ROUTER_CLIENT_SES *)dcb->session->router_session));
}
switch (reason) {
case DCB_REASON_NOT_RESPONDING: