Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
374de2c7
Commit
374de2c7
authored
May 24, 2007
by
msvensson@pilot.blaudden
Browse files
Options
Browse Files
Download
Plain Diff
Merge pilot.blaudden:/home/msvensson/mysql/bug26664/my50-bug26664
into pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
parents
a99fe7f3
93b1fe65
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
60 additions
and
49 deletions
+60
-49
include/mysql_com.h
include/mysql_com.h
+3
-0
include/violite.h
include/violite.h
+0
-1
libmysql/libmysql.c
libmysql/libmysql.c
+2
-4
server-tools/instance-manager/mysql_connection.cc
server-tools/instance-manager/mysql_connection.cc
+2
-2
sql-common/client.c
sql-common/client.c
+2
-4
sql/mysql_priv.h
sql/mysql_priv.h
+0
-3
sql/net_serv.cc
sql/net_serv.cc
+8
-8
sql/set_var.cc
sql/set_var.cc
+2
-2
sql/sql_client.cc
sql/sql_client.cc
+5
-2
sql/sql_parse.cc
sql/sql_parse.cc
+6
-6
sql/sql_repl.cc
sql/sql_repl.cc
+2
-2
vio/vio_priv.h
vio/vio_priv.h
+1
-0
vio/viosocket.c
vio/viosocket.c
+27
-15
No files found.
include/mysql_com.h
View file @
374de2c7
...
...
@@ -345,6 +345,9 @@ my_bool net_write_command(NET *net,unsigned char command,
int
net_real_write
(
NET
*
net
,
const
char
*
packet
,
unsigned
long
len
);
unsigned
long
my_net_read
(
NET
*
net
);
void
my_net_set_write_timeout
(
NET
*
net
,
uint
timeout
);
void
my_net_set_read_timeout
(
NET
*
net
,
uint
timeout
);
/*
The following function is not meant for normal usage
Currently it's used internally by manager.c
...
...
include/violite.h
View file @
374de2c7
...
...
@@ -88,7 +88,6 @@ my_bool vio_peer_addr(Vio* vio, char *buf, uint16 *port);
/* Remotes in_addr */
void
vio_in_addr
(
Vio
*
vio
,
struct
in_addr
*
in
);
my_bool
vio_poll_read
(
Vio
*
vio
,
uint
timeout
);
void
vio_timeout
(
Vio
*
vio
,
uint
which
,
uint
timeout
);
#ifdef HAVE_OPENSSL
#include <openssl/opensslv.h>
...
...
libmysql/libmysql.c
View file @
374de2c7
...
...
@@ -67,8 +67,6 @@
ulong
net_buffer_length
=
8192
;
ulong
max_allowed_packet
=
1024L
*
1024L
*
1024L
;
ulong
net_read_timeout
=
CLIENT_NET_READ_TIMEOUT
;
ulong
net_write_timeout
=
CLIENT_NET_WRITE_TIMEOUT
;
#ifdef EMBEDDED_LIBRARY
...
...
@@ -1528,8 +1526,8 @@ my_bool STDCALL mysql_embedded(void)
void
my_net_local_init
(
NET
*
net
)
{
net
->
max_packet
=
(
uint
)
net_buffer_length
;
net
->
read_timeout
=
(
uint
)
net_read_timeout
;
net
->
write_timeout
=
(
uint
)
net_write_timeout
;
my_net_set_read_timeout
(
net
,
CLIENT_NET_READ_TIMEOUT
)
;
my_net_set_write_timeout
(
net
,
CLIENT_NET_WRITE_TIMEOUT
)
;
net
->
retry_count
=
1
;
net
->
max_packet_size
=
max
(
net_buffer_length
,
max_allowed_packet
);
}
...
...
server-tools/instance-manager/mysql_connection.cc
View file @
374de2c7
...
...
@@ -112,8 +112,8 @@ C_MODE_START
void
my_net_local_init
(
NET
*
net
)
{
net
->
max_packet
=
net_buffer_length
;
net
->
read_timeout
=
net_read_timeout
;
net
->
write_timeout
=
net_write_timeout
;
my_net_set_read_timeout
(
net
,
(
uint
)
net_read_timeout
)
;
my_net_set_write_timeout
(
net
,
(
uint
)
net_write_timeout
)
;
net
->
retry_count
=
net_retry_count
;
net
->
max_packet_size
=
max_allowed_packet
;
}
...
...
sql-common/client.c
View file @
374de2c7
...
...
@@ -2047,13 +2047,11 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* 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
);
my_net_set_read_timeout
(
net
,
mysql
->
options
.
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
);
my_net_set_write_timeout
(
net
,
mysql
->
options
.
write_timeout
);
if
(
mysql
->
options
.
max_allowed_packet
)
net
->
max_packet_size
=
mysql
->
options
.
max_allowed_packet
;
...
...
sql/mysql_priv.h
View file @
374de2c7
...
...
@@ -89,9 +89,6 @@ void kill_one_thread(THD *thd, ulong id, bool only_kill_query);
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; } }
#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
...
...
sql/net_serv.cc
View file @
374de2c7
...
...
@@ -609,10 +609,10 @@ net_real_write(NET *net,const char *packet,ulong len)
#ifndef NO_ALARM
thr_alarm_init
(
&
alarmed
);
if
(
net_blocking
)
thr_alarm
(
&
alarmed
,
(
uint
)
net
->
write_timeout
,
&
alarm_buff
);
thr_alarm
(
&
alarmed
,
net
->
write_timeout
,
&
alarm_buff
);
#else
alarmed
=
0
;
/* Write timeout is set in net_set_write_timeout */
/* Write timeout is set in
my_
net_set_write_timeout */
#endif
/* NO_ALARM */
pos
=
(
char
*
)
packet
;
end
=
pos
+
len
;
...
...
@@ -624,7 +624,7 @@ net_real_write(NET *net,const char *packet,ulong len)
#if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2))
if
((
interrupted
||
length
==
0
)
&&
!
thr_alarm_in_use
(
&
alarmed
))
{
if
(
!
thr_alarm
(
&
alarmed
,
(
uint
)
net
->
write_timeout
,
&
alarm_buff
))
if
(
!
thr_alarm
(
&
alarmed
,
net
->
write_timeout
,
&
alarm_buff
))
{
/* Always true for client */
my_bool
old_mode
;
while
(
vio_blocking
(
net
->
vio
,
TRUE
,
&
old_mode
)
<
0
)
...
...
@@ -805,7 +805,7 @@ my_real_read(NET *net, ulong *complen)
if
(
net_blocking
)
thr_alarm
(
&
alarmed
,
net
->
read_timeout
,
&
alarm_buff
);
#else
/* Read timeout is set in net_set_read_timeout */
/* Read timeout is set in
my_
net_set_read_timeout */
#endif
/* NO_ALARM */
pos
=
net
->
buff
+
net
->
where_b
;
/* net->packet -4 */
...
...
@@ -1117,9 +1117,9 @@ my_net_read(NET *net)
}
void
net_set_read_timeout
(
NET
*
net
,
uint
timeout
)
void
my_
net_set_read_timeout
(
NET
*
net
,
uint
timeout
)
{
DBUG_ENTER
(
"net_set_read_timeout"
);
DBUG_ENTER
(
"
my_
net_set_read_timeout"
);
DBUG_PRINT
(
"enter"
,
(
"timeout: %d"
,
timeout
));
net
->
read_timeout
=
timeout
;
#ifdef NO_ALARM
...
...
@@ -1129,9 +1129,9 @@ void net_set_read_timeout(NET *net, uint timeout)
}
void
net_set_write_timeout
(
NET
*
net
,
uint
timeout
)
void
my_
net_set_write_timeout
(
NET
*
net
,
uint
timeout
)
{
DBUG_ENTER
(
"net_set_write_timeout"
);
DBUG_ENTER
(
"
my_
net_set_write_timeout"
);
DBUG_PRINT
(
"enter"
,
(
"timeout: %d"
,
timeout
));
net
->
write_timeout
=
timeout
;
#ifdef NO_ALARM
...
...
sql/set_var.cc
View file @
374de2c7
...
...
@@ -1291,14 +1291,14 @@ static int check_completion_type(THD *thd, set_var *var)
static
void
fix_net_read_timeout
(
THD
*
thd
,
enum_var_type
type
)
{
if
(
type
!=
OPT_GLOBAL
)
net_set_read_timeout
(
&
thd
->
net
,
thd
->
variables
.
net_read_timeout
);
my_
net_set_read_timeout
(
&
thd
->
net
,
thd
->
variables
.
net_read_timeout
);
}
static
void
fix_net_write_timeout
(
THD
*
thd
,
enum_var_type
type
)
{
if
(
type
!=
OPT_GLOBAL
)
net_set_write_timeout
(
&
thd
->
net
,
thd
->
variables
.
net_write_timeout
);
my_
net_set_write_timeout
(
&
thd
->
net
,
thd
->
variables
.
net_write_timeout
);
}
static
void
fix_net_retry_count
(
THD
*
thd
,
enum_var_type
type
)
...
...
sql/sql_client.cc
View file @
374de2c7
...
...
@@ -28,8 +28,11 @@ void my_net_local_init(NET *net)
{
#ifndef EMBEDDED_LIBRARY
net
->
max_packet
=
(
uint
)
global_system_variables
.
net_buffer_length
;
net
->
read_timeout
=
(
uint
)
global_system_variables
.
net_read_timeout
;
net
->
write_timeout
=
(
uint
)
global_system_variables
.
net_write_timeout
;
my_net_set_read_timeout
(
net
,
(
uint
)
global_system_variables
.
net_read_timeout
);
my_net_set_write_timeout
(
net
,
(
uint
)
global_system_variables
.
net_write_timeout
);
net
->
retry_count
=
(
uint
)
global_system_variables
.
net_retry_count
;
net
->
max_packet_size
=
max
(
global_system_variables
.
net_buffer_length
,
global_system_variables
.
max_allowed_packet
);
...
...
sql/sql_parse.cc
View file @
374de2c7
...
...
@@ -1139,8 +1139,8 @@ pthread_handler_t handle_one_connection(void *arg)
net
->
no_send_error
=
0
;
/* Use "connect_timeout" value during connection phase */
net_set_read_timeout
(
net
,
connect_timeout
);
net_set_write_timeout
(
net
,
connect_timeout
);
my_
net_set_read_timeout
(
net
,
connect_timeout
);
my_
net_set_write_timeout
(
net
,
connect_timeout
);
if
((
error
=
check_connection
(
thd
)))
{
// Wrong permissions
...
...
@@ -1183,8 +1183,8 @@ pthread_handler_t handle_one_connection(void *arg)
}
/* 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
);
my_
net_set_read_timeout
(
net
,
thd
->
variables
.
net_read_timeout
);
my_
net_set_write_timeout
(
net
,
thd
->
variables
.
net_write_timeout
);
while
(
!
net
->
error
&&
net
->
vio
!=
0
&&
!
(
thd
->
killed
==
THD
::
KILL_CONNECTION
))
...
...
@@ -1536,7 +1536,7 @@ bool do_command(THD *thd)
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
);
my_
net_set_read_timeout
(
net
,
thd
->
variables
.
net_wait_timeout
);
thd
->
clear_error
();
// Clear error message
...
...
@@ -1568,7 +1568,7 @@ bool do_command(THD *thd)
}
/* Restore read timeout value */
net_set_read_timeout
(
net
,
thd
->
variables
.
net_read_timeout
);
my_
net_set_read_timeout
(
net
,
thd
->
variables
.
net_read_timeout
);
/*
packet_length contains length of data, as it was stored in packet
...
...
sql/sql_repl.cc
View file @
374de2c7
...
...
@@ -94,7 +94,7 @@ static int send_file(THD *thd)
the job
*/
old_timeout
=
net
->
read_timeout
;
net_set_read_timeout
(
net
,
thd
->
variables
.
net_wait_timeout
);
my_
net_set_read_timeout
(
net
,
thd
->
variables
.
net_wait_timeout
);
/*
We need net_flush here because the client will not know it needs to send
...
...
@@ -138,7 +138,7 @@ static int send_file(THD *thd)
error
=
0
;
err:
net_set_read_timeout
(
net
,
old_timeout
);
my_
net_set_read_timeout
(
net
,
old_timeout
);
if
(
fd
>=
0
)
(
void
)
my_close
(
fd
,
MYF
(
0
));
if
(
errmsg
)
...
...
vio/vio_priv.h
View file @
374de2c7
...
...
@@ -23,6 +23,7 @@
#include <violite.h>
void
vio_ignore_timeout
(
Vio
*
vio
,
uint
which
,
uint
timeout
);
void
vio_timeout
(
Vio
*
vio
,
uint
which
,
uint
timeout
);
#ifdef HAVE_OPENSSL
#include "my_net.h"
/* needed because of struct in_addr */
...
...
vio/viosocket.c
View file @
374de2c7
...
...
@@ -204,13 +204,14 @@ int vio_fastsend(Vio * vio __attribute__((unused)))
{
#ifdef __WIN__
BOOL
nodelay
=
1
;
r
=
setsockopt
(
vio
->
sd
,
IPPROTO_TCP
,
TCP_NODELAY
,
(
const
char
*
)
&
nodelay
,
sizeof
(
nodelay
));
#else
int
nodelay
=
1
;
r
=
setsockopt
(
vio
->
sd
,
IPPROTO_TCP
,
TCP_NODELAY
,
(
void
*
)
&
nodelay
,
#endif
r
=
setsockopt
(
vio
->
sd
,
IPPROTO_TCP
,
TCP_NODELAY
,
IF_WIN
(
const
char
*
,
void
*
)
&
nodelay
,
sizeof
(
nodelay
));
#endif
/* __WIN__ */
}
if
(
r
)
{
...
...
@@ -380,28 +381,39 @@ my_bool vio_poll_read(Vio *vio,uint timeout)
void
vio_timeout
(
Vio
*
vio
,
uint
which
,
uint
timeout
)
{
/* TODO: some action should be taken if socket timeouts are not supported. */
#if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)
int
r
;
DBUG_ENTER
(
"vio_timeout"
);
{
#ifdef __WIN__
/* Windows expects time in milliseconds as int. */
/* Windows expects time in milliseconds as int */
int
wait_timeout
=
(
int
)
timeout
*
1000
;
#else
/* ! __WIN__ */
#else
/* POSIX specifies time as struct timeval. */
struct
timeval
wait_timeout
;
wait_timeout
.
tv_sec
=
timeout
;
wait_timeout
.
tv_usec
=
0
;
#endif
r
=
setsockopt
(
vio
->
sd
,
SOL_SOCKET
,
which
?
SO_SNDTIMEO
:
SO_RCVTIMEO
,
IF_WIN
(
const
char
*
,
const
void
*
)
&
wait_timeout
,
sizeof
(
wait_timeout
));
#endif
/* ! __WIN__ */
}
/* TODO: return value should be checked. */
(
void
)
setsockopt
(
vio
->
sd
,
SOL_SOCKET
,
which
?
SO_SNDTIMEO
:
SO_RCVTIMEO
,
(
char
*
)
&
wait_timeout
,
sizeof
(
wait_timeout
));
#ifndef DBUG_OFF
if
(
r
!=
0
)
DBUG_PRINT
(
"error"
,
(
"setsockopt failed: %d, errno: %d"
,
r
,
socket_errno
));
#endif
#endif
/* defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) */
DBUG_VOID_RETURN
;
#else
/*
Platforms not suporting setting of socket timeout should either use
thr_alarm or just run without read/write timeout(s)
*/
#endif
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment