diff options
author | Alexander Nozdrin <alik@sun.com> | 2009-11-25 13:47:01 +0300 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2009-11-25 13:47:01 +0300 |
commit | 12b5d5b19a608d1697ba8d77632b9fc5b90976cd (patch) | |
tree | b01a7c92b75393e3cc14eacc3866761146d6226d /vio | |
parent | 70dcf75b26d93dc4e08687419373c3f90bb4c3fb (diff) | |
parent | 0a9d4e675ad3b176909d30c5a6aa8ab1f0b7186b (diff) | |
download | mariadb-git-12b5d5b19a608d1697ba8d77632b9fc5b90976cd.tar.gz |
Auto-merge from mysql-next-mr-runtime.
Diffstat (limited to 'vio')
-rw-r--r-- | vio/viosocket.c | 24 |
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; +} |