summaryrefslogtreecommitdiff
path: root/vio
diff options
context:
space:
mode:
authorMats Kindahl <mats.kindahl@oracle.com>2010-08-16 14:50:27 +0200
committerMats Kindahl <mats.kindahl@oracle.com>2010-08-16 14:50:27 +0200
commitb0836bd309e5b7857771ccae7096f0fdcdfc58e2 (patch)
tree60ab98cb19a6a71445b167b4cbc5308f59767cc9 /vio
parent0ea3fb557deb017cd96f1e57694d56a5ace8c80c (diff)
parent7017775fd11c4249c1b64ff45564c88b94cf526f (diff)
downloadmariadb-git-b0836bd309e5b7857771ccae7096f0fdcdfc58e2.tar.gz
Merging with mysql-5.5-stage.
Diffstat (limited to 'vio')
-rw-r--r--vio/vio.c10
-rw-r--r--vio/vio_priv.h3
-rw-r--r--vio/viosocket.c4
-rw-r--r--vio/viossl.c5
4 files changed, 21 insertions, 1 deletions
diff --git a/vio/vio.c b/vio/vio.c
index 67704a56b22..48f103c33e8 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -44,6 +44,11 @@ static my_bool no_poll_read(Vio *vio __attribute__((unused)),
#endif
+static my_bool has_no_data(Vio *vio __attribute__((unused)))
+{
+ return FALSE;
+}
+
/*
* Helper to fill most of the Vio* with defaults.
*/
@@ -83,6 +88,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->poll_read =no_poll_read;
vio->is_connected =vio_is_connected_pipe;
+ vio->has_data =has_no_data;
vio->timeout=vio_win32_timeout;
/* Set default timeout */
@@ -110,6 +116,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->poll_read =no_poll_read;
vio->is_connected =vio_is_connected_shared_memory;
+ vio->has_data =has_no_data;
/* Currently, shared memory is on Windows only, hence the below is ok*/
vio->timeout= vio_win32_timeout;
@@ -137,6 +144,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->timeout =vio_timeout;
vio->poll_read =vio_poll_read;
vio->is_connected =vio_is_connected;
+ vio->has_data =vio_ssl_has_data;
DBUG_VOID_RETURN;
}
#endif /* HAVE_OPENSSL */
@@ -155,6 +163,8 @@ static void vio_init(Vio* vio, enum enum_vio_type type,
vio->timeout =vio_timeout;
vio->poll_read =vio_poll_read;
vio->is_connected =vio_is_connected;
+ vio->has_data= (flags & VIO_BUFFERED_READ) ?
+ vio_buff_has_data : has_no_data;
DBUG_VOID_RETURN;
}
diff --git a/vio/vio_priv.h b/vio/vio_priv.h
index 69eb26083d6..1bfb857b039 100644
--- a/vio/vio_priv.h
+++ b/vio/vio_priv.h
@@ -49,6 +49,7 @@ int vio_close_shared_memory(Vio * vio);
#endif
void vio_timeout(Vio *vio,uint which, uint timeout);
+my_bool vio_buff_has_data(Vio *vio);
#ifdef HAVE_OPENSSL
#include "my_net.h" /* needed because of struct in_addr */
@@ -62,5 +63,7 @@ void vio_ssl_delete(Vio *vio);
int vio_ssl_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode);
+my_bool vio_ssl_has_data(Vio *vio);
+
#endif /* HAVE_OPENSSL */
#endif /* VIO_PRIV_INCLUDED */
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 9c0243db4f3..163eb279d45 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -98,6 +98,10 @@ size_t vio_read_buff(Vio *vio, uchar* buf, size_t size)
#undef VIO_UNBUFFERED_READ_MIN_SIZE
}
+my_bool vio_buff_has_data(Vio *vio)
+{
+ return (vio->read_pos != vio->read_end);
+}
size_t vio_write(Vio * vio, const uchar* buf, size_t size)
{
diff --git a/vio/viossl.c b/vio/viossl.c
index 79f358b047c..5cb5f36f20d 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -244,6 +244,9 @@ int vio_ssl_blocking(Vio *vio __attribute__((unused)),
return (set_blocking_mode ? 0 : 1);
}
-
+my_bool vio_ssl_has_data(Vio *vio)
+{
+ return SSL_pending(vio->ssl_arg) > 0 ? TRUE : FALSE;
+}
#endif /* HAVE_OPENSSL */