summaryrefslogtreecommitdiff
path: root/vio/vio.c
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2009-11-10 17:36:38 -0200
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2009-11-10 17:36:38 -0200
commit17871ade9a47d1c2e34187c0be9c2cb880d29caa (patch)
treecd2a6e4896a743f9dc89d6b6b5273f487ba04ccb /vio/vio.c
parent80582b000f5cd5f6dfb24bed45df907b2c96ab02 (diff)
downloadmariadb-git-17871ade9a47d1c2e34187c0be9c2cb880d29caa.tar.gz
Backport of Bug#41860 to mysql-next-mr
------------------------------------------------------------ revno: 3317 revision-id: davi.arnaut@sun.com-20090522170916-fzc5ca3tjs9roy1t parent: patrick.crews@sun.com-20090522152933-ole8s3suy4zqyvku committer: Davi Arnaut <Davi.Arnaut@Sun.COM> branch nick: 41860-6.0 timestamp: Fri 2009-05-22 14:09:16 -0300 message: Bug#41860: Without Windows named pipe The problem was that the patch for Bug#10374 broke named pipe and shared memory transports on Windows due to a failure to implement a dummy poll method for transports other than BSD sockets. Another problem was that mysqltest lacked support for named pipe and shared memory connections, which lead to misleading test cases that were supposed run common queries over both transports. The solution is to properly implement, at the VIO layer, the poll and is_connected methods. The is_connected method is implemented for every suppported transport and the poll one only where it makes sense. Furthermore, support for named pipe and shared memory connections is added to mysqltest as to enable testing of both transports using the test suite. client/mysqltest.cc: Add support for named pipe and shared memory connections. include/violite.h: Move private functions to vio/vio_priv.h Add poll_read and is_connected methods. mysql-test/t/named_pipe.test: Run tests over a named pipe connection. mysql-test/t/shm.test: Run tests over a shared memory connection. sql/item_func.cc: Rename method. sql/sql_class.cc: Remove higher-level vio_is_connected implementation. sql/sql_class.h: Rename vio_is_connected to not conflict with the vio one. Verify that there is a valid vio. vio/vio.c: Add poll_read and is_connected methods. vio/vio_priv.h: Add private functions. vio/viosocket.c: Implement the is_connected method for the various transports.
Diffstat (limited to 'vio/vio.c')
-rw-r--r--vio/vio.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/vio/vio.c b/vio/vio.c
index e088687098b..5eca4bd1dc6 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -22,6 +22,28 @@
#include "vio_priv.h"
+#if defined(__WIN__) || defined(HAVE_SMEM)
+
+/**
+ Stub poll_read method that defaults to indicate that there
+ is data to read.
+
+ Used for named pipe and shared memory VIO types.
+
+ @param vio Unused.
+ @param timeout Unused.
+
+ @retval FALSE There is data to read.
+*/
+
+static my_bool no_poll_read(Vio *vio __attribute__((unused)),
+ uint timeout __attribute__((unused)))
+{
+ return FALSE;
+}
+
+#endif
+
/*
* Helper to fill most of the Vio* with defaults.
*/
@@ -60,6 +82,8 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->vioblocking =vio_blocking;
vio->is_blocking =vio_is_blocking;
vio->timeout =vio_ignore_timeout;
+ vio->poll_read =no_poll_read;
+ vio->is_connected =vio_is_connected_pipe;
}
else /* default is VIO_TYPE_TCPIP */
#endif
@@ -80,6 +104,8 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->vioblocking =vio_blocking;
vio->is_blocking =vio_is_blocking;
vio->timeout =vio_ignore_timeout;
+ vio->poll_read =no_poll_read;
+ vio->is_connected =vio_is_connected_shared_memory;
}
else
#endif
@@ -100,6 +126,8 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->vioblocking =vio_ssl_blocking;
vio->is_blocking =vio_is_blocking;
vio->timeout =vio_timeout;
+ vio->poll_read =vio_poll_read;
+ vio->is_connected =vio_is_connected;
}
else /* default is VIO_TYPE_TCPIP */
#endif /* HAVE_OPENSSL */
@@ -118,6 +146,8 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->vioblocking =vio_blocking;
vio->is_blocking =vio_is_blocking;
vio->timeout =vio_timeout;
+ vio->poll_read =vio_poll_read;
+ vio->is_connected =vio_is_connected;
}
DBUG_VOID_RETURN;
}