summaryrefslogtreecommitdiff
path: root/vio
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2009-11-25 18:03:05 +0300
committerAlexander Nozdrin <alik@sun.com>2009-11-25 18:03:05 +0300
commit52c66b56710046034fc631df4f3a165ba5a704f7 (patch)
treeb7488b7a2e23cf4b596766c1c84f64235543757a /vio
parent72a26125e21fc4c654a8a1c9c1841f79f62d4d7a (diff)
parentbe0add42f53b23d8a5e279cb3041a3fc93e375a0 (diff)
downloadmariadb-git-52c66b56710046034fc631df4f3a165ba5a704f7.tar.gz
Manual merge/pull from mysql-next-mr.
Conflicts: - sql/sql_insert.cc
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 86268795e60..f6048cdbe97 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -856,3 +856,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;
+}