Ensure that ER_CONNECTION_KILLED error message is not lost
my_real_read() detects if the connection was killed and sets error to ER_CONNECTION_KILLED. However net_real_write() overrides the error with ER_NET_READ_INTERRUPTED or ER_NET_READ_ERROR when it tries to send the 'Connection was killed' to the user on a closed connection. Fixed by not overwriting the original error code if the connection was shutdown. Rewiewed-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
parent
b12e8d9095
commit
64a1458847
@ -773,6 +773,9 @@ net_real_write(NET *net,const uchar *packet, size_t len)
|
|||||||
}
|
}
|
||||||
#endif /* !defined(MYSQL_SERVER) */
|
#endif /* !defined(MYSQL_SERVER) */
|
||||||
net->error= 2; /* Close socket */
|
net->error= 2; /* Close socket */
|
||||||
|
|
||||||
|
if (net->vio->state != VIO_STATE_SHUTDOWN || net->last_errno == 0)
|
||||||
|
{
|
||||||
net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED :
|
net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED :
|
||||||
ER_NET_ERROR_ON_WRITE);
|
ER_NET_ERROR_ON_WRITE);
|
||||||
#ifdef MYSQL_SERVER
|
#ifdef MYSQL_SERVER
|
||||||
@ -785,6 +788,7 @@ net_real_write(NET *net,const uchar *packet, size_t len)
|
|||||||
(ulong) (end-pos));
|
(ulong) (end-pos));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
MYSQL_SERVER_my_error(net->last_errno, MYF(0));
|
MYSQL_SERVER_my_error(net->last_errno, MYF(0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user