diff options
author | unknown <msvensson@pilot.mysql.com> | 2007-01-29 14:31:48 +0100 |
---|---|---|
committer | unknown <msvensson@pilot.mysql.com> | 2007-01-29 14:31:48 +0100 |
commit | a195ad5ea26227dac0d5f503b9e37717b2bc40be (patch) | |
tree | 439ceec10fe0ab45b030eb00f2e47e06330862a3 /sql/net_serv.cc | |
parent | b95f107371606a6771e28447750372e172513d95 (diff) | |
download | mariadb-git-a195ad5ea26227dac0d5f503b9e37717b2bc40be.tar.gz |
Bug#22943 syscall pruning in libmysql
- Set the timeout values only where needed
sql/mysql_priv.h:
Add new functions for setting read and write timeout on "net"
sql/mysqld.cc:
- Move the setting of "read_timeout" to the value of "connect_timeout" to
just before 'check_connection' which is the function where we want
to use the different timeout
- With the new functions to set timeout on "net", there is no need to
specifically set the default wait_timeout on windows.
sql/net_serv.cc:
Add new functions for setting read and write timeout of "net, when
server is compiled not to use alarms it will set the write/read timeout
directly on connection using 'vio_timeout'(using setsockopt if socket)
sql/repl_failsafe.cc:
Put unused code within "#if NOT_USED"
sql/set_var.cc:
Use 'net_set_*_timeout' when adjusting timeout value
on the current connection
sql/slave.cc:
The read timeout used when connecting to master server is set
using 'mysql_options' in 'connect_to_master' function
sql/sql_parse.cc:
- Set read and write timeout values to "connect_timeout" during
connect phase
- Use "read_timeout" value during sslaccept phase, since this is during
connect phase it implies "connect-timeout"
- Set read and write timeout value back to default after connect phase
- Set "read_timeout" to "wait_timeout" while waiting for client.
sql/sql_repl.cc:
Set "read_timeout" to "wait_timeout" while ask other mysqld to send file
sql-common/client.c:
Call 'vio_timeout' to set up the read and write timeout's for the
newly created connection. It only need to be done once at connect time.
vio/vio.c:
Use 'vio_timeout' for setting timeout also on an SSL connection
since they both use sockets
vio/viossl.c:
Remove 'vio_ssl_timeout' function
Diffstat (limited to 'sql/net_serv.cc')
-rw-r--r-- | sql/net_serv.cc | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 08184537896..a5a05d381cd 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -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; @@ -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 */ @@ -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; +} |