Fixed dcb_write_SSL being called multiple times on failure.
This commit is contained in:
@ -1594,11 +1594,12 @@ dcb_write_SSL(DCB *dcb, GWBUF *queue)
|
|||||||
}
|
}
|
||||||
#endif /* FAKE_CODE */
|
#endif /* FAKE_CODE */
|
||||||
qlen = GWBUF_LENGTH(queue);
|
qlen = GWBUF_LENGTH(queue);
|
||||||
|
do
|
||||||
|
{
|
||||||
w = gw_write_SSL(dcb->ssl, GWBUF_DATA(queue), qlen);
|
w = gw_write_SSL(dcb->ssl, GWBUF_DATA(queue), qlen);
|
||||||
dcb->stats.n_writes++;
|
dcb->stats.n_writes++;
|
||||||
|
|
||||||
if (w < 0)
|
if (w <= 0)
|
||||||
{
|
{
|
||||||
int ssl_errno = SSL_get_error(dcb->ssl,w);
|
int ssl_errno = SSL_get_error(dcb->ssl,w);
|
||||||
|
|
||||||
@ -1652,9 +1653,9 @@ dcb_write_SSL(DCB *dcb, GWBUF *queue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LOG_IS_ENABLED(LOGFILE_ERROR))
|
if (LOG_IS_ENABLED(LOGFILE_ERROR) && ssl_errno != SSL_ERROR_WANT_WRITE)
|
||||||
{
|
{
|
||||||
if (ssl_errno != 0)
|
if (ssl_errno == -1)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
@ -1667,25 +1668,43 @@ dcb_write_SSL(DCB *dcb, GWBUF *queue)
|
|||||||
ssl_errno)));
|
ssl_errno)));
|
||||||
if(ssl_errno == SSL_ERROR_SSL)
|
if(ssl_errno == SSL_ERROR_SSL)
|
||||||
{
|
{
|
||||||
while((ssl_errno = ERR_get_error()) != 0)
|
do
|
||||||
{
|
{
|
||||||
char errbuf[140];
|
char errbuf[140];
|
||||||
ERR_error_string(ssl_errno,errbuf);
|
ERR_error_string(ssl_errno,errbuf);
|
||||||
skygw_log_write(LE,"%s",errbuf);
|
skygw_log_write(LE,"%s",errbuf);
|
||||||
}
|
}while((ssl_errno = ERR_get_error()) != 0);
|
||||||
}
|
}
|
||||||
if(ssl_errno == SSL_ERROR_SYSCALL)
|
if(ssl_errno == SSL_ERROR_SYSCALL)
|
||||||
{
|
{
|
||||||
skygw_log_write(LE,"%d:%s",errno,strerror(errno));
|
skygw_log_write(LE,"%d:%s",errno,strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(w == 0)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
char errbuf[140];
|
||||||
|
ERR_error_string(ssl_errno,errbuf);
|
||||||
|
skygw_log_write(LE,"%s",errbuf);
|
||||||
|
}while((ssl_errno = ERR_get_error()) != 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ssl_errno != SSL_ERROR_WANT_WRITE)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}while(w <= 0);
|
||||||
/*
|
/*
|
||||||
* Pull the number of bytes we have written from
|
* Pull the number of bytes we have written from
|
||||||
* queue with have.
|
* queue with have.
|
||||||
*/
|
*/
|
||||||
|
if(w == -1)
|
||||||
|
{
|
||||||
|
while((queue = GWBUF_CONSUME_ALL(queue)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
queue = gwbuf_consume(queue, w);
|
queue = gwbuf_consume(queue, w);
|
||||||
LOGIF(LD, (skygw_log_write(
|
LOGIF(LD, (skygw_log_write(
|
||||||
LOGFILE_DEBUG,
|
LOGFILE_DEBUG,
|
||||||
@ -1696,6 +1715,7 @@ dcb_write_SSL(DCB *dcb, GWBUF *queue)
|
|||||||
dcb,
|
dcb,
|
||||||
STRDCBSTATE(dcb->state),
|
STRDCBSTATE(dcb->state),
|
||||||
dcb->fd)));
|
dcb->fd)));
|
||||||
|
}
|
||||||
} /*< while (queue != NULL) */
|
} /*< while (queue != NULL) */
|
||||||
/*<
|
/*<
|
||||||
* What wasn't successfully written is stored to write queue
|
* What wasn't successfully written is stored to write queue
|
||||||
|
|||||||
Reference in New Issue
Block a user