Removed walking of packets from mysql_backend and moved storing of partial packets to session command handling section.

This commit is contained in:
Markus Makela
2015-03-23 11:17:07 +02:00
parent b416455f4f
commit 9e1dc40bb5

View File

@ -494,33 +494,17 @@ static int gw_read_backend_event(DCB *dcb) {
} }
if (dcb->dcb_readqueue) if (dcb->dcb_readqueue)
{
if (read_buffer != NULL)
{ {
read_buffer = gwbuf_append(dcb->dcb_readqueue, read_buffer); read_buffer = gwbuf_append(dcb->dcb_readqueue, read_buffer);
} }
else
{
read_buffer = dcb->dcb_readqueue;
}
nbytes_read = gwbuf_length(read_buffer); nbytes_read = gwbuf_length(read_buffer);
if (nbytes_read < 3)
{
dcb->dcb_readqueue = read_buffer;
rc = 0;
goto return_rc;
}
{
GWBUF *tmp = modutil_get_complete_packets(&read_buffer);
if(tmp == NULL)
{
/** No complete packets */
dcb->dcb_readqueue = read_buffer;
rc = 0;
goto return_rc;
}
dcb->dcb_readqueue = read_buffer;
read_buffer = tmp;
} }
/** /**
@ -530,6 +514,13 @@ static int gw_read_backend_event(DCB *dcb) {
if (protocol_get_srv_command((MySQLProtocol *)dcb->protocol, false) != if (protocol_get_srv_command((MySQLProtocol *)dcb->protocol, false) !=
MYSQL_COM_UNDEFINED) MYSQL_COM_UNDEFINED)
{ {
if(nbytes_read < 5)
{
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
rc = 0;
goto return_rc;
}
read_buffer = process_response_data(dcb, read_buffer, nbytes_read); read_buffer = process_response_data(dcb, read_buffer, nbytes_read);
/** /**
* Received incomplete response to session command. * Received incomplete response to session command.