From af5596b32e650287f84650a9dda8a5170a23b6d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 May 2005 17:17:57 +0200 Subject: Bug #9721 net_write_timeout not used on Windows Added an extra parameter to all calls to timeout(). 1 means we want to set the write timeout 0 means we wnat to set the read timeout viossl.c: Add which parameter to ssl timeout routine vio_priv.h: Added which parameter to vio_ignore_timeout and vio_ssl_timeout violite.h: Add which parameter to vio_timeout sigs net_serv.cc: Use proper which code in call to vio_timeout to set the proper timeout viosocket.c: Set the appropriate timeout in vio_timeout vio/viosocket.c: Set the appropriate timeout in vio_timeout sql/net_serv.cc: Use proper which code in call to vio_timeout to set the proper timeout include/violite.h: Add which parameter to vio_timeout sigs vio/vio_priv.h: Added which parameter to vio_ignore_timeout and vio_ssl_timeout vio/viossl.c: Add which parameter to ssl timeout routine BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + include/violite.h | 6 +++--- sql/net_serv.cc | 4 ++-- vio/vio_priv.h | 4 ++-- vio/viosocket.c | 9 +++++++-- vio/viossl.c | 3 ++- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 1b33d659cfd..b77de4dbb49 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -195,6 +195,7 @@ ram@mysql.r18.ru ram@ram.(none) ramil@mysql.com ranger@regul.home.lan +rburnett@bk-internal.mysql.com rburnett@build.mysql.com reggie@bob.(none) reggie@mdk10.(none) diff --git a/include/violite.h b/include/violite.h index b89b01f95f4..4b644051dd2 100644 --- a/include/violite.h +++ b/include/violite.h @@ -81,7 +81,7 @@ 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 timeout); +void vio_timeout(Vio *vio,uint which, uint timeout); #ifdef HAVE_OPENSSL #include @@ -149,7 +149,7 @@ int vio_close_shared_memory(Vio * vio); #define vio_close(vio) ((vio)->vioclose)(vio) #define vio_peer_addr(vio, buf, prt) (vio)->peer_addr(vio, buf, prt) #define vio_in_addr(vio, in) (vio)->in_addr(vio, in) -#define vio_timeout(vio, seconds) (vio)->timeout(vio, seconds) +#define vio_timeout(vio, which, seconds) (vio)->timeout(vio, which, seconds) #endif /* defined(HAVE_VIO) && !defined(DONT_MAP_VIO) */ /* This enumerator is used in parser - should be always visible */ @@ -189,7 +189,7 @@ struct st_vio void (*in_addr)(Vio*, struct in_addr*); my_bool (*should_retry)(Vio*); int (*vioclose)(Vio*); - void (*timeout)(Vio*, unsigned int timeout); + void (*timeout)(Vio*, unsigned int which, unsigned int timeout); void *ssl_arg; #ifdef HAVE_SMEM HANDLE handle_file_map; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index c8b2e28ec52..bd4505a3d7f 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, net->write_timeout); + vio_timeout(net->vio, 1, net->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, net->read_timeout); + vio_timeout(net->vio, 0, net->read_timeout); #endif /* NO_ALARM */ pos = net->buff + net->where_b; /* net->packet -4 */ diff --git a/vio/vio_priv.h b/vio/vio_priv.h index 9a925a2c4c9..3a75a08021d 100644 --- a/vio/vio_priv.h +++ b/vio/vio_priv.h @@ -23,7 +23,7 @@ #include #include -void vio_ignore_timeout(Vio *vio, uint timeout); +void vio_ignore_timeout(Vio *vio, uint which, uint timeout); #ifdef HAVE_OPENSSL #include "my_net.h" /* needed because of struct in_addr */ @@ -31,7 +31,7 @@ void vio_ignore_timeout(Vio *vio, uint timeout); void vio_ssl_delete(Vio* vio); int vio_ssl_read(Vio *vio,gptr buf, int size); int vio_ssl_write(Vio *vio,const gptr buf,int size); -void vio_ssl_timeout(Vio *vio, uint timeout); +void vio_ssl_timeout(Vio *vio, uint which, uint timeout); /* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible. */ int vio_ssl_fastsend(Vio *vio); diff --git a/vio/viosocket.c b/vio/viosocket.c index 77922594469..b6aa793f57b 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -318,11 +318,16 @@ my_bool vio_poll_read(Vio *vio,uint timeout) void vio_timeout(Vio *vio __attribute__((unused)), - uint timeout __attribute__((unused))) + uint which __attribute__((unused)), + uint timeout __attribute__((unused))) { #ifdef __WIN__ ulong wait_timeout= (ulong) timeout * 1000; - (void) setsockopt(vio->sd, SOL_SOCKET, SO_RCVTIMEO, (char*) &wait_timeout, + if (which == 0) + (void) setsockopt(vio->sd, SOL_SOCKET, SO_RCVTIMEO, (char*) &wait_timeout, + sizeof(wait_timeout)); + else + (void) setsockopt(vio->sd, SOL_SOCKET, SO_SNDTIMEO, (char*) &wait_timeout, sizeof(wait_timeout)); #endif /* __WIN__ */ } diff --git a/vio/viossl.c b/vio/viossl.c index 07713c83763..773d444063b 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -421,7 +421,8 @@ int vio_ssl_blocking(Vio * vio __attribute__((unused)), void vio_ssl_timeout(Vio *vio __attribute__((unused)), - uint timeout __attribute__((unused))) + uint which __attribute__((unused)), + uint timeout __attribute__((unused))) { /* Not yet implemented (non critical) */ } -- cgit v1.2.1 From 8b49ccace4bff3348b9e5eea33473879335bb39f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 10:43:29 +0200 Subject: Bug#10193 Invalid DataDir in config causes ndbd segfault ndb/src/kernel/error/ErrorReporter.cpp: print error and return error if unable to open the file for error reporting. --- ndb/src/kernel/error/ErrorReporter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ndb/src/kernel/error/ErrorReporter.cpp b/ndb/src/kernel/error/ErrorReporter.cpp index 35cd3f099d9..7c77e7932ee 100644 --- a/ndb/src/kernel/error/ErrorReporter.cpp +++ b/ndb/src/kernel/error/ErrorReporter.cpp @@ -237,6 +237,11 @@ WriteMessage(ErrorCategory thrdType, int thrdMessageID, // Create a new file, and skip the first 69 bytes, // which are info about the current offset stream = fopen(theErrorFileName, "w"); + if(stream == NULL) + { + fprintf(stderr,"Unable to open error log file: %s\n", theErrorFileName); + return -1; + } fprintf(stream, "%s%u%s", "Current byte-offset of file-pointer is: ", 69, " \n\n\n"); -- cgit v1.2.1 From 779ac9cf9e92deb2e3a9d55e3718b7f069998726 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 15:08:10 +0200 Subject: Bug #9721 net_write_timeout not used on Windows viosocket.c: Use ?: syntax to simplify code for setting both timeouts vio/viosocket.c: Use ?: syntax to simplify code for setting both timeouts --- vio/viosocket.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/vio/viosocket.c b/vio/viosocket.c index b6aa793f57b..172d9127dc2 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -323,12 +323,9 @@ void vio_timeout(Vio *vio __attribute__((unused)), { #ifdef __WIN__ ulong wait_timeout= (ulong) timeout * 1000; - if (which == 0) - (void) setsockopt(vio->sd, SOL_SOCKET, SO_RCVTIMEO, (char*) &wait_timeout, - sizeof(wait_timeout)); - else - (void) setsockopt(vio->sd, SOL_SOCKET, SO_SNDTIMEO, (char*) &wait_timeout, - sizeof(wait_timeout)); + (void) setsockopt(vio->sd, SOL_SOCKET, + which ? SO_SNDTIMEO : SO_RCVTIMEO, (char*) &wait_timeout, + sizeof(wait_timeout)); #endif /* __WIN__ */ } -- cgit v1.2.1