Commit fce1b993 authored by Simon Morlat's avatar Simon Morlat

purge error queue before doing any SSL_read() or SSL_write()

parent 8a650b89
......@@ -725,7 +725,7 @@ ssize_t tls_read(tls_t *tls)
return (ssize_t)tls->read_buffer_len;
tls->read_events = SU_WAIT_IN;
ERR_clear_error();
ret = SSL_read(tls->con, tls->read_buffer, tls_buffer_size);
if (ret <= 0)
return tls_error(tls, ret, "tls_read: SSL_read", NULL, 0);
......@@ -809,7 +809,7 @@ ssize_t tls_write(tls_t *tls, void *buf, size_t size)
return 0;
tls->write_events = 0;
ERR_clear_error();
ret = SSL_write(tls->con, buf, size);
if (ret < 0)
return tls_error(tls, ret, "tls_write: SSL_write", buf, size);
......@@ -902,6 +902,7 @@ int tls_connect(su_root_magic_t *magic, su_wait_t *w, tport_t *self)
if (self->tp_is_connected == 0) {
int ret, status;
ERR_clear_error();
ret = self->tp_accepted ? SSL_accept(tls->con) : SSL_connect(tls->con);
status = SSL_get_error(tls->con, ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment