MXS-2216: Use correct function in response processing

When a response to a prepared statement was processed, the number of EOF
packets was used to see whether the response was complete. This code used
a function that does not work with the special packet returned by a PS
preparation that is similar to an OK packet.

The correct method is to count the total number of packets in the
response.
This commit is contained in:
Markus Mäkelä 2018-12-08 00:53:39 +02:00 committed by Johan Wikman
parent 87d2a45b20
commit 8b00a00ea7

View File

@ -659,24 +659,25 @@ static inline bool complete_ps_response(GWBUF *buffer)
if (mxs_mysql_extract_ps_response(buffer, &resp))
{
int expected_eof = 0;
int expected_packets = 1;
if (resp.columns > 0)
{
expected_eof++;
// Column definition packets plus one for the EOF
expected_packets += resp.columns + 1;
}
if (resp.parameters > 0)
{
expected_eof++;
// Parameter definition packets plus one for the EOF
expected_packets += resp.parameters + 1;
}
bool more;
int n_eof = modutil_count_signal_packets(buffer, 0, &more, NULL);
int n_packets = modutil_count_packets(buffer);
MXS_DEBUG("Expecting %u EOF, have %u", n_eof, expected_eof);
MXS_DEBUG("Expecting %u packets, have %u", n_packets, expected_packets);
rval = n_eof == expected_eof;
rval = n_packets == expected_packets;
}
return rval;