Added new state to SESSION: SESSION_STATE_STOPPING, which is set in protocol module before calling closeSession (router). THe new state tells that session is closing and DCBs included may not be polling anymore.
Fixed some crash scenarios.
This commit is contained in:
@ -129,6 +129,10 @@ session_alloc(SERVICE *service, DCB *client_dcb)
|
||||
session);
|
||||
|
||||
if (session->router_session == NULL) {
|
||||
/**
|
||||
* Inform other threads that session is closing.
|
||||
*/
|
||||
session->state == SESSION_STATE_STOPPING;
|
||||
/*<
|
||||
* Decrease refcount, set dcb's session pointer NULL
|
||||
* and set session pointer to NULL.
|
||||
@ -439,3 +443,18 @@ session_state(int state)
|
||||
return "Invalid State";
|
||||
}
|
||||
}
|
||||
|
||||
SESSION* get_session_by_router_ses(
|
||||
void* rses)
|
||||
{
|
||||
SESSION* ses = allSessions;
|
||||
|
||||
while (ses->router_session != rses && ses->next != NULL)
|
||||
ses = ses->next;
|
||||
|
||||
if (ses->router_session != rses)
|
||||
{
|
||||
ses = NULL;
|
||||
}
|
||||
return ses;
|
||||
}
|
||||
Reference in New Issue
Block a user