Fix bugs.

This commit is contained in:
counterpoint
2015-05-27 16:56:53 +01:00
parent 23e9a7b4e2
commit e5b4984a12

View File

@ -1311,24 +1311,26 @@ dcb_close(DCB *dcb)
dcb->session = NULL; dcb->session = NULL;
spinlock_release(&dcb->server->persistlock); spinlock_release(&dcb->server->persistlock);
atomic_add(&dcb->server->stats.n_persistent, 1); atomic_add(&dcb->server->stats.n_persistent, 1);
if (dcb->session)
{
spinlock_acquire(&dcb->session->ses_lock); spinlock_acquire(&dcb->session->ses_lock);
/** /**
* If session->state is STOPPING, start closing client session. * If session->state is STOPPING, start closing client session.
* Otherwise only this backend connection is closed. * Otherwise only this backend connection is closed.
*/ */
if (session != NULL && if (dcb->session->state == SESSION_STATE_STOPPING &&
session->state == SESSION_STATE_STOPPING && dcb->session->client != NULL &&
session->client != NULL && dcb->session->client->state == DCB_STATE_POLLING)
session->client->state == DCB_STATE_POLLING)
{ {
spinlock_release(&session->ses_lock); spinlock_release(&dcb->session->ses_lock);
/** Close client DCB */ /** Close client DCB */
dcb_close(session->client); dcb_close(dcb->session->client);
} }
else else
{ {
spinlock_release(&session->ses_lock); spinlock_release(&dcb->session->ses_lock);
}
} }
return; return;
} }