885
void Session::prepareForQueries()
887
if (variables.max_join_size == HA_POS_ERROR)
888
options |= OPTION_BIG_SELECTS;
889
if (client_capabilities & CLIENT_COMPRESS)
892
version= refresh_version;
898
/* In the past this would only run of the user did not have SUPER_ACL */
899
if (sys_init_connect.value_length)
901
execute_init_command(this, &sys_init_connect, &LOCK_sys_init_connect);
904
Security_context *sctx= &security_ctx;
905
killed= Session::KILL_CONNECTION;
906
errmsg_printf(ERRMSG_LVL_WARN
907
, ER(ER_NEW_ABORTING_CONNECTION)
909
, (db ? db : "unconnected")
910
, sctx->user.empty() == false ? sctx->user.c_str() : "unauthenticated"
911
, sctx->ip.c_str(), "init_connect command failed");
912
errmsg_printf(ERRMSG_LVL_WARN, "%s", main_da.message());
920
bool Session::initGlobals()
924
disconnect(ER_OUT_OF_RESOURCES, true);
925
statistic_increment(aborted_connects, &LOCK_status);
926
thread_scheduler.end_thread(this, 0);
886
932
bool Session::authenticate()
888
934
/* Use "connect_timeout" value during connection phase */
2126
2172
Session *session=current_session;
2127
2173
if (likely(session != 0))
2128
{ /* current_session==0 when close_connection() calls net_send_error() */
2174
{ /* current_session==0 when disconnect() calls net_send_error() */
2129
2175
session->status_var.bytes_sent+= length;
2490
@param session Thread handle
2491
@param errcode Error code to print to console
2492
@param should_lock 1 if we have have to lock LOCK_thread_count
2495
For the connection that is doing shutdown, this is called twice
2497
void Session::close_connection(uint32_t errcode, bool should_lock)
2533
void Session::disconnect(uint32_t errcode, bool should_lock)
2535
/* Allow any plugins to cleanup their session variables */
2536
plugin_sessionvar_cleanup(this);
2538
/* If necessary, log any aborted or unauthorized connections */
2539
if (killed || (net.error && net.vio != 0))
2540
statistic_increment(aborted_threads, &LOCK_status);
2542
if (net.error && net.vio != 0)
2544
if (! killed && variables.log_warnings > 1)
2546
Security_context *sctx= &security_ctx;
2548
errmsg_printf(ERRMSG_LVL_WARN, ER(ER_NEW_ABORTING_CONNECTION)
2550
, (db ? db : "unconnected")
2551
, sctx->user.empty() == false ? sctx->user.c_str() : "unauthenticated"
2553
, (main_da.is_error() ? main_da.message() : ER(ER_UNKNOWN_ERROR)));
2557
/* Close out our connection to the client */
2500
2559
if (should_lock)
2501
2560
(void) pthread_mutex_lock(&LOCK_thread_count);