diff options
Diffstat (limited to 'sql/sql_connect.h')
-rw-r--r-- | sql/sql_connect.h | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/sql/sql_connect.h b/sql/sql_connect.h index ef6484fa081..1a84cb56e5c 100644 --- a/sql/sql_connect.h +++ b/sql/sql_connect.h @@ -21,6 +21,7 @@ #include "structs.h" #include <mysql/psi/mysql_socket.h> #include <hash.h> +#include "violite.h" /* Object to hold connect information to be given to the newly created thread @@ -30,28 +31,33 @@ struct scheduler_functions; class CONNECT : public ilink { public: - /* To be copied to THD */ - Vio *vio; /* Copied to THD with my_net_init() */ - const char *host; + MYSQL_SOCKET sock; +#ifdef _WIN32 + HANDLE pipe; + CONNECT(HANDLE pipe_arg): pipe(pipe_arg), vio_type(VIO_TYPE_NAMEDPIPE), + scheduler(thread_scheduler), thread_id(0), prior_thr_create_utime(0) {} +#endif + enum enum_vio_type vio_type; scheduler_functions *scheduler; my_thread_id thread_id; - pthread_t real_id; - bool extra_port; /* Own variables */ - bool thread_count_incremented; ulonglong prior_thr_create_utime; static Atomic_counter<uint32_t> count; - CONNECT() - :vio(0), host(0), scheduler(thread_scheduler), thread_id(0), real_id(0), - extra_port(0), - thread_count_incremented(0), prior_thr_create_utime(0) + CONNECT(MYSQL_SOCKET sock_arg, enum enum_vio_type vio_type_arg, + scheduler_functions *scheduler_arg): sock(sock_arg), + vio_type(vio_type_arg), scheduler(scheduler_arg), thread_id(0), + prior_thr_create_utime(0) { count++; - }; - ~CONNECT(); + } + ~CONNECT() + { + count--; + DBUG_ASSERT(vio_type == VIO_CLOSED); + } void close_and_delete(); void close_with_error(uint sql_errno, const char *message, uint close_error); @@ -74,7 +80,7 @@ void free_global_index_stats(void); void free_global_client_stats(void); pthread_handler_t handle_one_connection(void *arg); -void do_handle_one_connection(CONNECT *connect); +void do_handle_one_connection(CONNECT *connect, bool put_in_cache); bool init_new_connection_handler_thread(); void reset_mqh(LEX_USER *lu, bool get_them); bool check_mqh(THD *thd, uint check_command); @@ -85,7 +91,7 @@ void decrease_user_connections(USER_CONN *uc); #define decrease_user_connections(X) do { } while(0) /* nothing */ #endif bool thd_init_client_charset(THD *thd, uint cs_number); -bool setup_connection_thread_globals(THD *thd); +void setup_connection_thread_globals(THD *thd); bool thd_prepare_connection(THD *thd); bool thd_is_connection_alive(THD *thd); int thd_set_peer_addr(THD *thd, sockaddr_storage *addr, |