mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Merge pilot.mysql.com:/home/msvensson/mysql/bug22943/my41-bug22943
into pilot.mysql.com:/home/msvensson/mysql/mysql-4.1-maint
This commit is contained in:
@@ -867,7 +867,7 @@ static int check_connection(THD *thd)
|
||||
return(ER_HANDSHAKE_ERROR);
|
||||
}
|
||||
DBUG_PRINT("info", ("IO layer change in progress..."));
|
||||
if (sslaccept(ssl_acceptor_fd, net->vio, thd->variables.net_wait_timeout))
|
||||
if (sslaccept(ssl_acceptor_fd, net->vio, net->read_timeout))
|
||||
{
|
||||
DBUG_PRINT("error", ("Failed to read user information (pkt_len= %lu)",
|
||||
pkt_len));
|
||||
@@ -897,7 +897,6 @@ static int check_connection(THD *thd)
|
||||
if ((thd->client_capabilities & CLIENT_TRANSACTIONS) &&
|
||||
opt_using_transactions)
|
||||
net->return_status= &thd->server_status;
|
||||
net->read_timeout=(uint) thd->variables.net_read_timeout;
|
||||
|
||||
char *user= end;
|
||||
char *passwd= strend(user)+1;
|
||||
@@ -1029,6 +1028,10 @@ pthread_handler_decl(handle_one_connection,arg)
|
||||
NET *net= &thd->net;
|
||||
thd->thread_stack= (char*) &thd;
|
||||
|
||||
/* Use "connect_timeout" value during connection phase */
|
||||
net_set_read_timeout(net, connect_timeout);
|
||||
net_set_write_timeout(net, connect_timeout);
|
||||
|
||||
if ((error=check_connection(thd)))
|
||||
{ // Wrong permissions
|
||||
if (error > 0)
|
||||
@@ -1058,6 +1061,11 @@ pthread_handler_decl(handle_one_connection,arg)
|
||||
if (thd->query_error)
|
||||
thd->killed= 1;
|
||||
}
|
||||
|
||||
/* Connect completed, set read/write timeouts back to tdefault */
|
||||
net_set_read_timeout(net, thd->variables.net_read_timeout);
|
||||
net_set_write_timeout(net, thd->variables.net_write_timeout);
|
||||
|
||||
while (!net->error && net->vio != 0 && !thd->killed)
|
||||
{
|
||||
if (do_command(thd))
|
||||
@@ -1261,7 +1269,7 @@ err:
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
||||
/*
|
||||
Read one command from socket and execute it (query or simple command).
|
||||
Read one command from connection and execute it (query or simple command).
|
||||
This function is called in loop from thread function.
|
||||
SYNOPSIS
|
||||
do_command()
|
||||
@@ -1272,24 +1280,26 @@ err:
|
||||
|
||||
bool do_command(THD *thd)
|
||||
{
|
||||
char *packet;
|
||||
uint old_timeout;
|
||||
char *packet= 0;
|
||||
ulong packet_length;
|
||||
NET *net;
|
||||
NET *net= &thd->net;
|
||||
enum enum_server_command command;
|
||||
DBUG_ENTER("do_command");
|
||||
|
||||
net= &thd->net;
|
||||
/*
|
||||
indicator of uninitialized lex => normal flow of errors handling
|
||||
(see my_message_sql)
|
||||
*/
|
||||
thd->lex->current_select= 0;
|
||||
|
||||
packet=0;
|
||||
old_timeout=net->read_timeout;
|
||||
// Wait max for 8 hours
|
||||
net->read_timeout=(uint) thd->variables.net_wait_timeout;
|
||||
/*
|
||||
This thread will do a blocking read from the client which
|
||||
will be interrupted when the next command is received from
|
||||
the client, the connection is closed or "net_wait_timeout"
|
||||
number of seconds has passed
|
||||
*/
|
||||
net_set_read_timeout(net, thd->variables.net_wait_timeout);
|
||||
|
||||
thd->clear_error(); // Clear error message
|
||||
|
||||
net_new_transaction(net);
|
||||
@@ -1318,7 +1328,10 @@ bool do_command(THD *thd)
|
||||
vio_description(net->vio), command,
|
||||
command_name[command]));
|
||||
}
|
||||
net->read_timeout=old_timeout; // restore it
|
||||
|
||||
/* Restore read timeout value */
|
||||
net_set_read_timeout(net, thd->variables.net_read_timeout);
|
||||
|
||||
/*
|
||||
packet_length contains length of data, as it was stored in packet
|
||||
header. In case of malformed header, packet_length can be zero.
|
||||
|
Reference in New Issue
Block a user