Fix protocol command tracking

The command byte was always read at an offset of 4 instead of the current
offset plus 4.
This commit is contained in:
Markus Mäkelä 2017-12-01 11:15:05 +02:00
parent 0506669738
commit 5664cb8bf6

View File

@ -853,11 +853,11 @@ static bool process_client_commands(DCB* dcb, int bytes_available, GWBUF** buffe
* If we an empty packet or have at least 5 bytes of data, we can start
* sending the data to the router.
*/
if (pktlen && gwbuf_copy_data(queue, MYSQL_HEADER_LEN, 1, &cmd) != 1)
if (pktlen && gwbuf_copy_data(queue, offset + MYSQL_HEADER_LEN, 1, &cmd) != 1)
{
if ((queue = split_and_store(dcb, queue, offset)) == NULL)
{
ss_dassert(bytes_available == MYSQL_HEADER_LEN);
ss_dassert(bytes_available - offset == MYSQL_HEADER_LEN);
return false;
}
ss_dassert(offset > 0);