Move persistent from dcb_close to dcb_add_to_zombieslist
This commit is contained in:
@ -280,17 +280,33 @@ dcb_add_to_zombieslist(DCB *dcb)
|
|||||||
spinlock_release(&zombiespin);
|
spinlock_release(&zombiespin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*<
|
|
||||||
* Add closing dcb to the top of the list.
|
char *user;
|
||||||
*/
|
user = session_getUser(dcb->session);
|
||||||
dcb->memdata.next = zombies;
|
if (user && dcb->server)
|
||||||
zombies = dcb;
|
{
|
||||||
/*<
|
dcb->user = strdup(user);
|
||||||
* Set state which indicates that it has been added to zombies
|
spinlock_acquire(&dcb->server->persistlock);
|
||||||
* list.
|
dcb->nextpersistent = dcb->server->persistent;
|
||||||
*/
|
dcb->server->persistent = dcb;
|
||||||
succp = dcb_set_state(dcb, DCB_STATE_ZOMBIE, &prev_state);
|
spinlock_release(&dcb->server->persistlock);
|
||||||
ss_info_dassert(succp, "Failed to set DCB_STATE_ZOMBIE");
|
atomic_add(&dcb->server->stats.n_persistent, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*<
|
||||||
|
* Add closing dcb to the top of the list.
|
||||||
|
*/
|
||||||
|
dcb->memdata.next = zombies;
|
||||||
|
zombies = dcb;
|
||||||
|
/*<
|
||||||
|
* Set state which indicates that it has been added to zombies
|
||||||
|
* list.
|
||||||
|
*/
|
||||||
|
succp = dcb_set_state(dcb, DCB_STATE_ZOMBIE, &prev_state);
|
||||||
|
ss_info_dassert(succp, "Failed to set DCB_STATE_ZOMBIE");
|
||||||
|
}
|
||||||
|
|
||||||
spinlock_release(&zombiespin);
|
spinlock_release(&zombiespin);
|
||||||
}
|
}
|
||||||
@ -643,7 +659,7 @@ char *user;
|
|||||||
LOGFILE_DEBUG,
|
LOGFILE_DEBUG,
|
||||||
"About to attempt to get a persistent connection DCB")));
|
"About to attempt to get a persistent connection DCB")));
|
||||||
dcb = server_get_persistent(server, user, protocol);
|
dcb = server_get_persistent(server, user, protocol);
|
||||||
if (NULL != dcb)
|
if (dcb)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Link dcb to session. Unlink is called in dcb_final_free
|
* Link dcb to session. Unlink is called in dcb_final_free
|
||||||
@ -1243,7 +1259,7 @@ int above_water;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes dcb from poll set, and adds it to zombies list. As a consequense,
|
* Removes dcb from poll set, and adds it to zombies list. As a consequence,
|
||||||
* dcb first moves to DCB_STATE_NOPOLLING, and then to DCB_STATE_ZOMBIE state.
|
* dcb first moves to DCB_STATE_NOPOLLING, and then to DCB_STATE_ZOMBIE state.
|
||||||
* At the end of the function state may not be DCB_STATE_ZOMBIE because once
|
* At the end of the function state may not be DCB_STATE_ZOMBIE because once
|
||||||
* dcb_initlock is released parallel threads may change the state.
|
* dcb_initlock is released parallel threads may change the state.
|
||||||
@ -1305,19 +1321,6 @@ dcb_close(DCB *dcb)
|
|||||||
|
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
{
|
{
|
||||||
char *user;
|
|
||||||
user = session_getUser(dcb->session);
|
|
||||||
if (user && dcb->server)
|
|
||||||
{
|
|
||||||
dcb->user = strdup(user);
|
|
||||||
spinlock_acquire(&dcb->server->persistlock);
|
|
||||||
dcb->nextpersistent = dcb->server->persistent;
|
|
||||||
dcb->server->persistent = dcb;
|
|
||||||
spinlock_release(&dcb->server->persistlock);
|
|
||||||
atomic_add(&dcb->server->stats.n_persistent, 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* close protocol and router session
|
* close protocol and router session
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user