diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-04 07:55:16 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-04 07:55:16 +0300 |
commit | 9a7948e3f6d3fd7528e49f43eb4d41f8f55c8a35 (patch) | |
tree | 68f8e54f6c2484dc7791bee8c594d3d07c611d29 /vio/viosocket.c | |
parent | 56990b18d914b8150c9f777d134724d2b3390360 (diff) | |
parent | bbd70fcc43cc889e4593594ee5ca436fe1433aac (diff) | |
download | mariadb-git-9a7948e3f6d3fd7528e49f43eb4d41f8f55c8a35.tar.gz |
Merge 10.5 into 10.6
Diffstat (limited to 'vio/viosocket.c')
-rw-r--r-- | vio/viosocket.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/vio/viosocket.c b/vio/viosocket.c index 2d240688ce0..9cad035161c 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -1252,7 +1252,6 @@ my_bool vio_is_connected(Vio *vio) DBUG_RETURN(bytes ? TRUE : FALSE); } -#ifndef DBUG_OFF /** Number of bytes in the read or socket buffer @@ -1271,22 +1270,34 @@ ssize_t vio_pending(Vio *vio) return vio->read_end - vio->read_pos; /* Skip non-socket based transport types. */ - if (vio->type == VIO_TYPE_TCPIP || vio->type == VIO_TYPE_SOCKET) + switch (vio->type) { + case VIO_TYPE_TCPIP: + /* fallthrough */ + case VIO_TYPE_SOCKET: /* Obtain number of readable bytes in the socket buffer. */ if (socket_peek_read(vio, &bytes)) return -1; - } + return bytes; - /* - SSL not checked due to a yaSSL bug in SSL_pending that - causes it to attempt to read from the socket. - */ + case VIO_TYPE_SSL: + bytes= (uint) SSL_pending(vio->ssl_arg); + if (bytes) + return bytes; + if (socket_peek_read(vio, &bytes)) + return -1; + return bytes; - return (ssize_t) bytes; +#ifdef _WIN32 + case VIO_TYPE_NAMEDPIPE: + bytes= vio_pending_pipe(vio); + return bytes; +#endif + default: + return -1; + } } -#endif /* DBUG_OFF */ /** Checks if the error code, returned by vio_getnameinfo(), means it was the |