Fixes for MXS-196 and other related problems.

This commit is contained in:
counterpoint
2015-07-06 08:48:27 +01:00
parent 03b5a634f4
commit a72f462e2d
4 changed files with 92 additions and 32 deletions

View File

@ -724,7 +724,7 @@ int rc;
*/
rc = poll_add_dcb(dcb);
if (rc == DCBFD_CLOSED) {
if (rc) {
dcb_set_state(dcb, DCB_STATE_DISCONNECTED, NULL);
dcb_final_free(dcb);
return NULL;
@ -2362,6 +2362,23 @@ bool dcb_set_state(
return succp;
}
void dcb_revert_state(
DCB* dcb,
const dcb_state_t new_state,
dcb_state_t old_state)
{
CHK_DCB(dcb);
spinlock_acquire(&dcb->dcb_initlock);
if ((DCB_STATE_POLLING == new_state || DCB_STATE_LISTENING == new_state) && (DCB_STATE_ALLOC == old_state || DCB_STATE_NOPOLLING == old_state))
{
dcb->state = old_state;
spinlock_release(&dcb->dcb_initlock);
return;
}
else assert(false);
}
static bool dcb_set_state_nomutex(
DCB* dcb,
const dcb_state_t new_state,