summaryrefslogtreecommitdiff
path: root/sql/sql_connect.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-04-05 12:01:52 +0200
committerSergei Golubchik <sergii@pisem.net>2012-04-05 12:01:52 +0200
commitcbd52a42ee9b93675e5cdaa043df878c423b6571 (patch)
treef7159b893a8dc1d5efd540ef2b3b21227aaf2b6d /sql/sql_connect.cc
parent70a3cafe4d1aa28e1b6c36d9001bc0d487262976 (diff)
parentdea3544b2d9bd68961b8e84c3772deda435f15b5 (diff)
downloadmariadb-git-cbd52a42ee9b93675e5cdaa043df878c423b6571.tar.gz
merge
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r--sql/sql_connect.cc33
1 files changed, 29 insertions, 4 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index e32dde04de0..95e10648402 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2007, 2011, Oracle and/or its affiliates.
- Copyright (c) 2008-2011 Monty Program Ab
+ Copyright (c) 2007, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2011, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1096,13 +1096,38 @@ void prepare_new_connection_state(THD* thd)
execute_init_command(thd, &sys_init_connect, &LOCK_sys_init_connect);
if (thd->is_error())
{
- thd->killed= THD::KILL_CONNECTION;
+ ulong packet_length;
+ NET *net= &thd->net;
+
sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION),
- thd->thread_id,(thd->db ? thd->db : "unconnected"),
+ thd->thread_id,
+ thd->db ? thd->db : "unconnected",
sctx->user ? sctx->user : "unauthenticated",
sctx->host_or_ip, "init_connect command failed");
sql_print_warning("%s", thd->main_da.message());
+
+ thd->lex->current_select= 0;
+ my_net_set_read_timeout(net, thd->variables.net_wait_timeout);
+ thd->clear_error();
+ net_new_transaction(net);
+ packet_length= my_net_read(net);
+ /*
+ If my_net_read() failed, my_error() has been already called,
+ and the main Diagnostics Area contains an error condition.
+ */
+ if (packet_length != packet_error)
+ my_error(ER_NEW_ABORTING_CONNECTION, MYF(0),
+ thd->thread_id,
+ thd->db ? thd->db : "unconnected",
+ sctx->user ? sctx->user : "unauthenticated",
+ sctx->host_or_ip, "init_connect command failed");
+
+ thd->server_status&= ~SERVER_STATUS_CLEAR_SET;
+ net_end_statement(thd);
+ thd->killed = THD::KILL_CONNECTION;
+ return;
}
+
thd->proc_info=0;
thd->set_time();
thd->init_for_queries();