Fix session close in RoundRobinRouter

SERVER_REF->connections was decremented from the wrong struct.
This commit is contained in:
Esa Korhonen
2017-03-28 16:54:53 +03:00
parent 88b87aceb5
commit 07cc42927a

View File

@ -456,15 +456,21 @@ void RRRouterSession::close()
* of most API functions to quickly stop the processing of closed sessions. * of most API functions to quickly stop the processing of closed sessions.
*/ */
m_closed = true; m_closed = true;
int closed_conns = 0;
for (unsigned int i = 0; i < m_backend_dcbs.size(); i++) for (unsigned int i = 0; i < m_backend_dcbs.size(); i++)
{ {
DCB* dcb = m_backend_dcbs[i]; DCB* dcb = m_backend_dcbs[i];
SERVER_REF* sref = dcb->service->dbref; SERVER_REF* sref = dcb->service->dbref;
dcb_close(dcb); while (sref && (sref->server != dcb->server))
closed_conns++; {
sref = sref->next;
}
if (sref)
{
atomic_add(&(sref->connections), -1); atomic_add(&(sref->connections), -1);
} }
dcb_close(dcb);
}
int closed_conns = m_backend_dcbs.size();
m_backend_dcbs.clear(); m_backend_dcbs.clear();
if (m_write_dcb) if (m_write_dcb)
{ {