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,18 +773,22 @@ net_real_write(NET *net,const uchar *packet, size_t len)
|
||||
}
|
||||
#endif /* !defined(MYSQL_SERVER) */
|
||||
net->error= 2; /* Close socket */
|
||||
net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED :
|
||||
ER_NET_ERROR_ON_WRITE);
|
||||
#ifdef MYSQL_SERVER
|
||||
if (global_system_variables.log_warnings > 3)
|
||||
|
||||
if (net->vio->state != VIO_STATE_SHUTDOWN || net->last_errno == 0)
|
||||
{
|
||||
sql_print_warning("Could not write packet: fd: %lld state: %d "
|
||||
"errno: %d vio_errno: %d length: %ld",
|
||||
(longlong) vio_fd(net->vio), (int) net->vio->state,
|
||||
vio_errno(net->vio), net->last_errno,
|
||||
(ulong) (end-pos));
|
||||
}
|
||||
net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED :
|
||||
ER_NET_ERROR_ON_WRITE);
|
||||
#ifdef MYSQL_SERVER
|
||||
if (global_system_variables.log_warnings > 3)
|
||||
{
|
||||
sql_print_warning("Could not write packet: fd: %lld state: %d "
|
||||
"errno: %d vio_errno: %d length: %ld",
|
||||
(longlong) vio_fd(net->vio), (int) net->vio->state,
|
||||
vio_errno(net->vio), net->last_errno,
|
||||
(ulong) (end-pos));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
MYSQL_SERVER_my_error(net->last_errno, MYF(0));
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user