Cleaned up code.
This commit is contained in:
@ -3048,42 +3048,42 @@ char *name = NULL;
|
|||||||
* @param nread Number of bytes we have already read
|
* @param nread Number of bytes we have already read
|
||||||
* @return Number of bytes readable or -1 on error
|
* @return Number of bytes readable or -1 on error
|
||||||
*/
|
*/
|
||||||
int dcb_bytes_readable_SSL (DCB *dcb, int nread)
|
int dcb_bytes_readable_SSL(DCB *dcb, int nread)
|
||||||
{
|
{
|
||||||
int rval = 0;
|
int rval = 0;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
int rc = ioctl (dcb->fd, FIONREAD, &nbytes);
|
int rc = ioctl(dcb->fd, FIONREAD, &nbytes);
|
||||||
int pending = SSL_pending (dcb->ssl);
|
|
||||||
|
|
||||||
if (rc == -1)
|
if (rc == -1)
|
||||||
{
|
{
|
||||||
char errbuf[STRERROR_BUFLEN];
|
char errbuf[STRERROR_BUFLEN];
|
||||||
LOGIF (LE, (skygw_log_write_flush (LOGFILE_ERROR,
|
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
||||||
"Error : ioctl FIONREAD for dcb %p in "
|
"Error : ioctl FIONREAD for dcb %p in "
|
||||||
"state %s fd %d failed due error %d, %s.",
|
"state %s fd %d failed due error %d, %s.",
|
||||||
dcb,
|
dcb,
|
||||||
STRDCBSTATE (dcb->state),
|
STRDCBSTATE(dcb->state),
|
||||||
dcb->fd,
|
dcb->fd,
|
||||||
errno,
|
errno,
|
||||||
strerror_r (errno, errbuf, sizeof (errbuf)))));
|
strerror_r(errno, errbuf, sizeof (errbuf)))));
|
||||||
rval = -1;
|
rval = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int pending = SSL_pending(dcb->ssl);
|
||||||
rval = nbytes + pending;
|
rval = nbytes + pending;
|
||||||
if (rval == 0 && nread == 0)
|
if (rval == 0 && nread == 0)
|
||||||
{
|
{
|
||||||
/** Handle closed client socket */
|
/** Handle closed client socket */
|
||||||
if (dcb_isclient (dcb))
|
if (dcb_isclient(dcb))
|
||||||
{
|
{
|
||||||
char c = 0;
|
char c = 0;
|
||||||
int r = -1;
|
int r = -1;
|
||||||
|
|
||||||
/* try to read 1 byte, without consuming the socket buffer */
|
/* try to read 1 byte, without consuming the socket buffer */
|
||||||
r = SSL_peek (dcb->ssl, &c, sizeof (char));
|
r = SSL_peek(dcb->ssl, &c, sizeof (char));
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
{
|
{
|
||||||
int ssl_errno = SSL_get_error (dcb->ssl, r);
|
int ssl_errno = SSL_get_error(dcb->ssl, r);
|
||||||
if (ssl_errno != SSL_ERROR_WANT_READ &&
|
if (ssl_errno != SSL_ERROR_WANT_READ &&
|
||||||
ssl_errno != SSL_ERROR_WANT_WRITE &&
|
ssl_errno != SSL_ERROR_WANT_WRITE &&
|
||||||
ssl_errno != SSL_ERROR_NONE)
|
ssl_errno != SSL_ERROR_NONE)
|
||||||
@ -3094,8 +3094,8 @@ int dcb_bytes_readable_SSL (DCB *dcb, int nread)
|
|||||||
#ifdef SS_DEBUG
|
#ifdef SS_DEBUG
|
||||||
else if (nbytes != 0 || pending != 0)
|
else if (nbytes != 0 || pending != 0)
|
||||||
{
|
{
|
||||||
skygw_log_write_flush (LD, "Total: %d Socket: %d Pending: %d",
|
skygw_log_write_flush(LD, "Total: %d Socket: %d Pending: %d",
|
||||||
nread, nbytes, pending);
|
nread, nbytes, pending);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3134,7 +3134,7 @@ void dcb_log_ssl_read_error(DCB *dcb, int ssl_errno, int rc)
|
|||||||
{
|
{
|
||||||
while ((ssl_errno = ERR_get_error()) != 0)
|
while ((ssl_errno = ERR_get_error()) != 0)
|
||||||
{
|
{
|
||||||
ERR_error_string_n(ssl_errno, errbuf, 200);
|
ERR_error_string_n(ssl_errno, errbuf, STRERROR_BUFLEN);
|
||||||
skygw_log_write(LE,
|
skygw_log_write(LE,
|
||||||
"%s",
|
"%s",
|
||||||
errbuf);
|
errbuf);
|
||||||
|
Reference in New Issue
Block a user