Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä 2020-07-31 18:09:08 +03:00
commit 9216114ce7
125 changed files with 1968 additions and 947 deletions

View file

@ -33,6 +33,7 @@ my_bool vio_is_connected_pipe(Vio *vio);
int vio_close_pipe(Vio * vio);
int cancel_io(HANDLE handle, DWORD thread_id);
int vio_shutdown_pipe(Vio *vio,int how);
uint vio_pending_pipe(Vio* vio);
#endif

View file

@ -140,5 +140,11 @@ int vio_close_pipe(Vio *vio)
DBUG_RETURN(ret);
}
/* return number of bytes readable from pipe.*/
uint vio_pending_pipe(Vio *vio)
{
DWORD bytes;
return PeekNamedPipe(vio->hPipe, NULL, 0, NULL, &bytes, NULL) ? bytes : 0;
}
#endif

View file

@ -1232,7 +1232,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
@ -1251,22 +1250,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;
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;
#ifdef _WIN32
case VIO_TYPE_NAMEDPIPE:
bytes= vio_pending_pipe(vio);
return bytes;
#endif
default:
return -1;
}
/*
SSL not checked due to a yaSSL bug in SSL_pending that
causes it to attempt to read from the socket.
*/
return (ssize_t) bytes;
}
#endif /* DBUG_OFF */
/**
Checks if the error code, returned by vio_getnameinfo(), means it was the