internal void HandleTimeoutOrThreadAbort(Exception ex)
{
bool isFatal = false;
if (isKillQueryConnection)
{
// Special connection started to cancel a query.
// Abort will prevent recursive connection spawning
Abort();
if (ex is TimeoutException)
{
throw new MySqlException(Resources.Timeout, true, ex);
}
else
{
return;
}
}
try
{
// Do a fast cancel.The reason behind small values for connection
// and command timeout is that we do not want user to wait longer
// after command has already expired.
// Microsoft's SqlClient seems to be using 5 seconds timeouts
// here as well.
// Read the error packet with "interrupted" message.
CancelQuery(5);
driver.ResetTimeout(5000);
if (Reader != null)
{
Reader.Close();
Reader = null;
}
}
catch (Exception ex2)
{
MySqlTrace.LogWarning(ServerThread, "Could not kill query, " +
" aborting connection. Exception was " + ex2.Message);
Abort();
isFatal = true;
}
if (ex is TimeoutException)
{
throw new MySqlException(Resources.Timeout, isFatal, ex);
}
}