Cache: Handle large packets
Basically the only thing that needs to be done is not to mistake a 8 byte length encoded integer as an EOF packet.
This commit is contained in:
@ -477,12 +477,9 @@ int CacheFilterSession::handle_expecting_rows()
|
|||||||
|
|
||||||
if (m_res.offset + packetlen <= buflen)
|
if (m_res.offset + packetlen <= buflen)
|
||||||
{
|
{
|
||||||
// We have at least one complete packet.
|
if ((packetlen == MYSQL_EOF_PACKET_LEN) && (MYSQL_GET_COMMAND(header) == MYSQL_REPLY_EOF))
|
||||||
int command = (int)MYSQL_GET_COMMAND(header);
|
|
||||||
|
|
||||||
switch (command)
|
|
||||||
{
|
{
|
||||||
case 0xfe: // EOF, the one after the rows.
|
// The last EOF packet
|
||||||
m_res.offset += packetlen;
|
m_res.offset += packetlen;
|
||||||
ss_dassert(m_res.offset == buflen);
|
ss_dassert(m_res.offset == buflen);
|
||||||
|
|
||||||
@ -490,10 +487,10 @@ int CacheFilterSession::handle_expecting_rows()
|
|||||||
|
|
||||||
rv = send_upstream();
|
rv = send_upstream();
|
||||||
m_state = CACHE_EXPECTING_NOTHING;
|
m_state = CACHE_EXPECTING_NOTHING;
|
||||||
break;
|
}
|
||||||
|
else
|
||||||
case 0xfb: // NULL
|
{
|
||||||
default: // length-encoded-string
|
// Length encode strings, 0xfb denoting NULL.
|
||||||
m_res.offset += packetlen;
|
m_res.offset += packetlen;
|
||||||
++m_res.nRows;
|
++m_res.nRows;
|
||||||
|
|
||||||
@ -507,7 +504,6 @@ int CacheFilterSession::handle_expecting_rows()
|
|||||||
m_res.offset = buflen; // To abort the loop.
|
m_res.offset = buflen; // To abort the loop.
|
||||||
m_state = CACHE_IGNORING_RESPONSE;
|
m_state = CACHE_IGNORING_RESPONSE;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user