diff options
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r-- | sql/sql_connect.cc | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index fe6a101f999..a25fc0a6034 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1294,6 +1294,8 @@ void do_handle_one_connection(CONNECT *connect) { ulonglong thr_create_utime= microsecond_interval_timer(); THD *thd; + bool close_conn= false; + if (connect->scheduler->init_new_connection_thread() || !(thd= connect->create_thd(NULL))) { @@ -1341,18 +1343,37 @@ void do_handle_one_connection(CONNECT *connect) { bool create_user= TRUE; + mysql_socket_set_thread_owner(thd->net.vio->mysql_socket); if (thd_prepare_connection(thd)) { create_user= FALSE; goto end_thread; - } + } - while (thd_is_connection_alive(thd)) + if (thd->bundle_command.str) { + thd->bundle_command.str[thd->bundle_command.length]= '\0'; /* safety */ + + enum enum_server_command command= + fetch_command(thd, thd->bundle_command.str); + + close_conn= dispatch_command(command, thd, thd->bundle_command.str + 1, + (uint) (thd->bundle_command.length - 1), + FALSE, FALSE); + mysql_audit_release(thd); - if (do_command(thd)) - break; + } + + if (!close_conn) + { + while (thd_is_connection_alive(thd)) + { + DBUG_ASSERT(thd->bundle_command.str == NULL); + mysql_audit_release(thd); + if (do_command(thd)) + break; + } } end_connection(thd); |