summaryrefslogtreecommitdiff
path: root/vio
diff options
context:
space:
mode:
authorVladislav Vaintroub <vvaintroub@mysql.com>2009-11-25 15:20:14 +0100
committerVladislav Vaintroub <vvaintroub@mysql.com>2009-11-25 15:20:14 +0100
commit68cfabcc10b194e651aa681d804fc15754744204 (patch)
treee06536a82dab9f0549416006195fc1371ff528db /vio
parent39a158221ddac1c83766fe0b4635d854a664f262 (diff)
parentbe0add42f53b23d8a5e279cb3041a3fc93e375a0 (diff)
downloadmariadb-git-68cfabcc10b194e651aa681d804fc15754744204.tar.gz
merge
Diffstat (limited to 'vio')
-rw-r--r--vio/viosocket.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 30187cbed56..51345d072b2 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -855,3 +855,27 @@ int vio_close_shared_memory(Vio * vio)
}
#endif /* HAVE_SMEM */
#endif /* __WIN__ */
+
+
+/**
+ Number of bytes in the read buffer.
+
+ @return number of bytes in the read buffer or < 0 if error.
+*/
+
+ssize_t vio_pending(Vio *vio)
+{
+#ifdef HAVE_OPENSSL
+ SSL *ssl= (SSL*) vio->ssl_arg;
+#endif
+
+ if (vio->read_pos < vio->read_end)
+ return vio->read_end - vio->read_pos;
+
+#ifdef HAVE_OPENSSL
+ if (ssl)
+ return SSL_pending(ssl);
+#endif
+
+ return 0;
+}