mirror of
https://github.com/irssi/irssi.git
synced 2026-08-20 09:02:13 +02:00
Clear error queue before SSL I/O operations
Otherwise we can see errors that are not related to the operation we check for. SSL_get_error() inspects the thread's error queue. See https://www.openssl.org/docs/manmaster/ssl/SSL_get_error.html for more information.
This commit is contained in:
parent
66e9c4bb39
commit
be733d2482
1 changed files with 3 additions and 0 deletions
|
|
@ -289,6 +289,7 @@ static GIOStatus irssi_ssl_read(GIOChannel *handle, gchar *buf, gsize len, gsize
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
gchar *errmsg;
|
gchar *errmsg;
|
||||||
|
|
||||||
|
ERR_clear_error();
|
||||||
ret1 = SSL_read(chan->ssl, buf, len);
|
ret1 = SSL_read(chan->ssl, buf, len);
|
||||||
if(ret1 <= 0)
|
if(ret1 <= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -334,6 +335,7 @@ static GIOStatus irssi_ssl_write(GIOChannel *handle, const gchar *buf, gsize len
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
gchar *errmsg;
|
gchar *errmsg;
|
||||||
|
|
||||||
|
ERR_clear_error();
|
||||||
ret1 = SSL_write(chan->ssl, (const char *)buf, len);
|
ret1 = SSL_write(chan->ssl, (const char *)buf, len);
|
||||||
if(ret1 <= 0)
|
if(ret1 <= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -581,6 +583,7 @@ int irssi_ssl_handshake(GIOChannel *handle)
|
||||||
X509 *cert;
|
X509 *cert;
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
|
|
||||||
|
ERR_clear_error();
|
||||||
ret = SSL_connect(chan->ssl);
|
ret = SSL_connect(chan->ssl);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
err = SSL_get_error(chan->ssl, ret);
|
err = SSL_get_error(chan->ssl, ret);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue