The listener DCB is now properly closed instead of just being removed from the poll set.
This commit is contained in:
Markus Makela 2015-06-21 12:51:54 +03:00
parent 79c20bfae8
commit e14b29baf9
5 changed files with 23 additions and 14 deletions

View File

@ -1949,13 +1949,15 @@ dcb_close(DCB *dcb)
}
ss_dassert(dcb->state == DCB_STATE_POLLING ||
dcb->state == DCB_STATE_LISTENING ||
dcb->state == DCB_STATE_NOPOLLING ||
dcb->state == DCB_STATE_ZOMBIE);
/*<
* Stop dcb's listening and modify state accordingly.
*/
if (dcb->state == DCB_STATE_POLLING)
if (dcb->state == DCB_STATE_POLLING ||
dcb->state == DCB_STATE_LISTENING)
{
rc = poll_remove_dcb(dcb);
@ -2428,6 +2430,10 @@ static bool dcb_set_state_nomutex(
case DCB_STATE_POLLING: /*< ok to try but state can't change */
succp = true;
break;
case DCB_STATE_LISTENING:
dcb->state = new_state;
succp = true;
break;
default:
ss_dassert(old_state != NULL);
break;

View File

@ -330,7 +330,8 @@ poll_remove_dcb(DCB *dcb)
CHK_DCB(dcb);
/*< It is possible that dcb has already been removed from the set */
if (dcb->state != DCB_STATE_POLLING)
if (dcb->state != DCB_STATE_POLLING &&
dcb->state != DCB_STATE_LISTENING)
{
if (dcb->state == DCB_STATE_NOPOLLING ||
dcb->state == DCB_STATE_ZOMBIE)

View File

@ -534,11 +534,13 @@ int listeners = 0;
port = service->ports;
while (port)
{
poll_remove_dcb(port->listener);
port->listener->session->state = SESSION_STATE_LISTENER_STOPPED;
if(port->listener)
{
dcb_close(port->listener);
port->listener = NULL;
listeners++;
port = port->next;
}
port = port->next;
}
service->state = SERVICE_STATE_STOPPED;
@ -562,13 +564,10 @@ int listeners = 0;
port = service->ports;
while (port)
{
if (poll_add_dcb(port->listener) == 0) {
port->listener->session->state = SESSION_STATE_LISTENER;
listeners++;
}
port = port->next;
listeners += serviceStartPort(service,port);
port = port->next;
}
service->state = SERVICE_STATE_STARTED;
return listeners;
}

View File

@ -1771,7 +1771,7 @@ gw_client_close(DCB *dcb)
dcb->state == DCB_STATE_NOPOLLING ||
dcb->state == DCB_STATE_ZOMBIE)
{
if (!DCB_IS_CLONE(dcb)) CHK_PROTOCOL(protocol);
if (!DCB_IS_CLONE(dcb) && protocol) CHK_PROTOCOL(protocol);
}
#endif
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,

View File

@ -128,7 +128,10 @@ void mysql_protocol_done (
MySQLProtocol* p;
server_command_t* scmd;
server_command_t* scmd2;
if(dcb->protocol == NULL)
return;
p = (MySQLProtocol *)dcb->protocol;
spinlock_acquire(&p->protocol_lock);