Loading sql-common/client.c +7 −1 Original line number Diff line number Diff line Loading @@ -1881,11 +1881,17 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, goto error; } vio_keepalive(net->vio,TRUE); /* Override local client variables */ /* If user set read_timeout, let it override the default */ if (mysql->options.read_timeout) net->read_timeout= mysql->options.read_timeout; vio_timeout(net->vio, 0, net->read_timeout); /* If user set write_timeout, let it override the default */ if (mysql->options.write_timeout) net->write_timeout= mysql->options.write_timeout; vio_timeout(net->vio, 1, net->write_timeout); if (mysql->options.max_allowed_packet) net->max_packet_size= mysql->options.max_allowed_packet; Loading sql/mysql_priv.h +2 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,8 @@ void kill_one_thread(THD *thd, ulong id); bool net_request_file(NET* net, const char* fname); char* query_table_status(THD *thd,const char *db,const char *table_name); void net_set_write_timeout(NET *net, uint timeout); void net_set_read_timeout(NET *net, uint timeout); #define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); } #define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } } Loading sql/mysqld.cc +2 −8 Original line number Diff line number Diff line Loading @@ -3601,10 +3601,9 @@ static bool read_init_file(char *file_name) #ifndef EMBEDDED_LIBRARY static void create_new_thread(THD *thd) { NET *net=&thd->net; DBUG_ENTER("create_new_thread"); NET *net=&thd->net; // For easy ref net->read_timeout = (uint) connect_timeout; if (protocol_version > 9) net->return_errno=1; Loading Loading @@ -3899,12 +3898,7 @@ extern "C" pthread_handler_decl(handle_connections_sockets, } if (sock == unix_sock) thd->host=(char*) my_localhost; #ifdef __WIN__ /* Set default wait_timeout */ ulong wait_timeout= global_system_variables.net_wait_timeout * 1000; (void) setsockopt(new_sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&wait_timeout, sizeof(wait_timeout)); #endif create_new_thread(thd); } Loading sql/net_serv.cc +25 −2 Original line number Diff line number Diff line Loading @@ -491,7 +491,7 @@ net_real_write(NET *net,const char *packet,ulong len) thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff); #else alarmed=0; vio_timeout(net->vio, 1, net->write_timeout); /* Write timeout is set in net_set_write_timeout */ #endif /* NO_ALARM */ pos=(char*) packet; end=pos+len; Loading Loading @@ -684,7 +684,7 @@ my_real_read(NET *net, ulong *complen) if (net_blocking) thr_alarm(&alarmed,net->read_timeout,&alarm_buff); #else vio_timeout(net->vio, 0, net->read_timeout); /* Read timeout is set in net_set_read_timeout */ #endif /* NO_ALARM */ pos = net->buff + net->where_b; /* net->packet -4 */ Loading Loading @@ -995,3 +995,26 @@ my_net_read(NET *net) return len; } void net_set_read_timeout(NET *net, uint timeout) { DBUG_ENTER("net_set_read_timeout"); DBUG_PRINT("enter", ("timeout: %d", timeout)); net->read_timeout= timeout; #ifdef NO_ALARM vio_timeout(net->vio, 0, timeout); #endif DBUG_VOID_RETURN; } void net_set_write_timeout(NET *net, uint timeout) { DBUG_ENTER("net_set_write_timeout"); DBUG_PRINT("enter", ("timeout: %d", timeout)); net->write_timeout= timeout; #ifdef NO_ALARM vio_timeout(net->vio, 1, timeout); #endif DBUG_VOID_RETURN; } sql/repl_failsafe.cc +6 −3 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ static Slave_log_event* find_slave_event(IO_CACHE* log, functions like register_slave()) are working. */ #if NOT_USED static int init_failsafe_rpl_thread(THD* thd) { DBUG_ENTER("init_failsafe_rpl_thread"); Loading Loading @@ -99,7 +100,7 @@ static int init_failsafe_rpl_thread(THD* thd) thd->set_time(); DBUG_RETURN(0); } #endif void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status) { Loading Loading @@ -573,12 +574,14 @@ HOSTS"; } #if NOT_USED int find_recovery_captain(THD* thd, MYSQL* mysql) { return 0; } #endif #if NOT_USED pthread_handler_decl(handle_failsafe_rpl,arg) { DBUG_ENTER("handle_failsafe_rpl"); Loading Loading @@ -626,7 +629,7 @@ pthread_handler_decl(handle_failsafe_rpl,arg) pthread_exit(0); DBUG_RETURN(0); } #endif int show_slave_hosts(THD* thd) { Loading Loading
sql-common/client.c +7 −1 Original line number Diff line number Diff line Loading @@ -1881,11 +1881,17 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, goto error; } vio_keepalive(net->vio,TRUE); /* Override local client variables */ /* If user set read_timeout, let it override the default */ if (mysql->options.read_timeout) net->read_timeout= mysql->options.read_timeout; vio_timeout(net->vio, 0, net->read_timeout); /* If user set write_timeout, let it override the default */ if (mysql->options.write_timeout) net->write_timeout= mysql->options.write_timeout; vio_timeout(net->vio, 1, net->write_timeout); if (mysql->options.max_allowed_packet) net->max_packet_size= mysql->options.max_allowed_packet; Loading
sql/mysql_priv.h +2 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,8 @@ void kill_one_thread(THD *thd, ulong id); bool net_request_file(NET* net, const char* fname); char* query_table_status(THD *thd,const char *db,const char *table_name); void net_set_write_timeout(NET *net, uint timeout); void net_set_read_timeout(NET *net, uint timeout); #define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); } #define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } } Loading
sql/mysqld.cc +2 −8 Original line number Diff line number Diff line Loading @@ -3601,10 +3601,9 @@ static bool read_init_file(char *file_name) #ifndef EMBEDDED_LIBRARY static void create_new_thread(THD *thd) { NET *net=&thd->net; DBUG_ENTER("create_new_thread"); NET *net=&thd->net; // For easy ref net->read_timeout = (uint) connect_timeout; if (protocol_version > 9) net->return_errno=1; Loading Loading @@ -3899,12 +3898,7 @@ extern "C" pthread_handler_decl(handle_connections_sockets, } if (sock == unix_sock) thd->host=(char*) my_localhost; #ifdef __WIN__ /* Set default wait_timeout */ ulong wait_timeout= global_system_variables.net_wait_timeout * 1000; (void) setsockopt(new_sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&wait_timeout, sizeof(wait_timeout)); #endif create_new_thread(thd); } Loading
sql/net_serv.cc +25 −2 Original line number Diff line number Diff line Loading @@ -491,7 +491,7 @@ net_real_write(NET *net,const char *packet,ulong len) thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff); #else alarmed=0; vio_timeout(net->vio, 1, net->write_timeout); /* Write timeout is set in net_set_write_timeout */ #endif /* NO_ALARM */ pos=(char*) packet; end=pos+len; Loading Loading @@ -684,7 +684,7 @@ my_real_read(NET *net, ulong *complen) if (net_blocking) thr_alarm(&alarmed,net->read_timeout,&alarm_buff); #else vio_timeout(net->vio, 0, net->read_timeout); /* Read timeout is set in net_set_read_timeout */ #endif /* NO_ALARM */ pos = net->buff + net->where_b; /* net->packet -4 */ Loading Loading @@ -995,3 +995,26 @@ my_net_read(NET *net) return len; } void net_set_read_timeout(NET *net, uint timeout) { DBUG_ENTER("net_set_read_timeout"); DBUG_PRINT("enter", ("timeout: %d", timeout)); net->read_timeout= timeout; #ifdef NO_ALARM vio_timeout(net->vio, 0, timeout); #endif DBUG_VOID_RETURN; } void net_set_write_timeout(NET *net, uint timeout) { DBUG_ENTER("net_set_write_timeout"); DBUG_PRINT("enter", ("timeout: %d", timeout)); net->write_timeout= timeout; #ifdef NO_ALARM vio_timeout(net->vio, 1, timeout); #endif DBUG_VOID_RETURN; }
sql/repl_failsafe.cc +6 −3 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ static Slave_log_event* find_slave_event(IO_CACHE* log, functions like register_slave()) are working. */ #if NOT_USED static int init_failsafe_rpl_thread(THD* thd) { DBUG_ENTER("init_failsafe_rpl_thread"); Loading Loading @@ -99,7 +100,7 @@ static int init_failsafe_rpl_thread(THD* thd) thd->set_time(); DBUG_RETURN(0); } #endif void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status) { Loading Loading @@ -573,12 +574,14 @@ HOSTS"; } #if NOT_USED int find_recovery_captain(THD* thd, MYSQL* mysql) { return 0; } #endif #if NOT_USED pthread_handler_decl(handle_failsafe_rpl,arg) { DBUG_ENTER("handle_failsafe_rpl"); Loading Loading @@ -626,7 +629,7 @@ pthread_handler_decl(handle_failsafe_rpl,arg) pthread_exit(0); DBUG_RETURN(0); } #endif int show_slave_hosts(THD* thd) { Loading