Skip to content

Commit

Permalink
MDEV-19893 Do not send error packets with seqno= 0
Browse files Browse the repository at this point in the history
  • Loading branch information
vaintroub committed Jun 27, 2019
1 parent dc11aab commit 51c3a5c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sql/protocol.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -461,6 +461,17 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
*/ */
if ((save_compress= net->compress)) if ((save_compress= net->compress))
net->compress= 2; net->compress= 2;

/*
Sometimes, we send errors "out-of-band", e.g ER_CONNECTION_KILLED
on an idle connection. The current protocol "sequence number" is 0,
however some client drivers would however always expect packets
coming from server to have seq_no > 0, due to missing awareness
of "out-of-band" operations. Make these clients happy.
*/
if (!net->pkt_nr)
net->pkt_nr= 1;

ret= net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) buff, ret= net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) buff,
length); length);
net->compress= save_compress; net->compress= save_compress;
Expand Down

0 comments on commit 51c3a5c

Please sign in to comment.