Remove multi-packet additions to response parsing

The additions to the packet parsing code weren't necessary once the
statement output change was reverted.
This commit is contained in:
Markus Mäkelä
2017-04-04 09:55:24 +03:00
parent 5037646846
commit 8fe31f360d
6 changed files with 64 additions and 105 deletions

View File

@ -635,17 +635,18 @@ GWBUF* modutil_get_complete_packets(GWBUF **p_readbuf)
return complete;
}
int modutil_count_signal_packets(GWBUF *reply, int n_found, bool* more, size_t* offset)
int modutil_count_signal_packets(GWBUF *reply, int n_found, bool* more)
{
unsigned int len = gwbuf_length(reply);
int eof = 0;
int err = 0;
size_t offset = 0;
while (*offset < len)
while (offset < len)
{
uint8_t header[MYSQL_HEADER_LEN + 5]; // Maximum size of an EOF packet
gwbuf_copy_data(reply, *offset, MYSQL_HEADER_LEN + 1, header);
gwbuf_copy_data(reply, offset, MYSQL_HEADER_LEN + 1, header);
unsigned int pktlen = MYSQL_GET_PAYLOAD_LEN(header) + MYSQL_HEADER_LEN;
@ -659,16 +660,16 @@ int modutil_count_signal_packets(GWBUF *reply, int n_found, bool* more, size_t*
eof++;
}
if (*offset + pktlen >= len || (eof + err + n_found) >= 2)
if (offset + pktlen >= len || (eof + err + n_found) >= 2)
{
gwbuf_copy_data(reply, *offset, sizeof(header), header);
gwbuf_copy_data(reply, offset, sizeof(header), header);
uint16_t* status = (uint16_t*)(header + MYSQL_HEADER_LEN + 1 + 2); // Skip command and warning count
*more = ((*status) & SERVER_MORE_RESULTS_EXIST);
*offset += pktlen;
offset += pktlen;
break;
}
*offset += pktlen;
offset += pktlen;
}
int total = err + eof + n_found;