Call ERR_clear_error() where necessary

This commit is contained in:
Přemysl Eric Janouch 2015-07-12 05:30:13 +02:00
parent 4ead42f4e3
commit d5a153bbe3
3 changed files with 6 additions and 0 deletions

View File

@ -4009,6 +4009,7 @@ transport_tls_try_read (struct server *s)
data->ssl_rx_want_tx = false; data->ssl_rx_want_tx = false;
while (true) while (true)
{ {
ERR_clear_error ();
str_ensure_space (buf, 512); str_ensure_space (buf, 512);
int n_read = SSL_read (data->ssl, buf->str + buf->len, int n_read = SSL_read (data->ssl, buf->str + buf->len,
buf->alloc - buf->len - 1 /* null byte */); buf->alloc - buf->len - 1 /* null byte */);
@ -4046,6 +4047,7 @@ transport_tls_try_write (struct server *s)
data->ssl_tx_want_rx = false; data->ssl_tx_want_rx = false;
while (buf->len) while (buf->len)
{ {
ERR_clear_error ();
int n_written = SSL_write (data->ssl, buf->str, buf->len); int n_written = SSL_write (data->ssl, buf->str, buf->len);
const char *error_info = NULL; const char *error_info = NULL;

2
kike.c
View File

@ -3113,6 +3113,7 @@ irc_try_read_ssl (struct client *c)
while (true) while (true)
{ {
str_ensure_space (buf, 512); str_ensure_space (buf, 512);
ERR_clear_error ();
int n_read = SSL_read (c->ssl, buf->str + buf->len, int n_read = SSL_read (c->ssl, buf->str + buf->len,
buf->alloc - buf->len - 1 /* null byte */); buf->alloc - buf->len - 1 /* null byte */);
@ -3179,6 +3180,7 @@ irc_try_write_ssl (struct client *c)
c->ssl_tx_want_rx = false; c->ssl_tx_want_rx = false;
while (buf->len) while (buf->len)
{ {
ERR_clear_error ();
int n_written = SSL_write (c->ssl, buf->str, buf->len); int n_written = SSL_write (c->ssl, buf->str, buf->len);
const char *error_info = NULL; const char *error_info = NULL;

View File

@ -281,6 +281,7 @@ irc_send (struct bot_context *ctx, const char *format, ...)
if (ctx->ssl) if (ctx->ssl)
{ {
// TODO: call SSL_get_error() to detect if a clean shutdown has occured // TODO: call SSL_get_error() to detect if a clean shutdown has occured
ERR_clear_error ();
if (SSL_write (ctx->ssl, str.str, str.len) != (int) str.len) if (SSL_write (ctx->ssl, str.str, str.len) != (int) str.len)
{ {
print_debug ("%s: %s: %s", __func__, "SSL_write", print_debug ("%s: %s: %s", __func__, "SSL_write",
@ -1447,6 +1448,7 @@ irc_fill_read_buffer_ssl (struct bot_context *ctx, struct str *buf)
{ {
int n_read; int n_read;
start: start:
ERR_clear_error ();
n_read = SSL_read (ctx->ssl, buf->str + buf->len, n_read = SSL_read (ctx->ssl, buf->str + buf->len,
buf->alloc - buf->len - 1 /* null byte */); buf->alloc - buf->len - 1 /* null byte */);