mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
be_openssl: clear all pending errors before SSL_*() calls
Refs: #350 Reported-by: @CapSel
This commit is contained in:
parent
ce38993333
commit
38e0f4a5d6
@ -593,6 +593,7 @@ do_read(struct bufferevent_openssl *bev_ssl, int n_to_read) {
|
|||||||
for (i=0; i<n; ++i) {
|
for (i=0; i<n; ++i) {
|
||||||
if (bev_ssl->bev.read_suspended)
|
if (bev_ssl->bev.read_suspended)
|
||||||
break;
|
break;
|
||||||
|
ERR_clear_error();
|
||||||
r = SSL_read(bev_ssl->ssl, space[i].iov_base, space[i].iov_len);
|
r = SSL_read(bev_ssl->ssl, space[i].iov_base, space[i].iov_len);
|
||||||
if (r>0) {
|
if (r>0) {
|
||||||
result |= OP_MADE_PROGRESS;
|
result |= OP_MADE_PROGRESS;
|
||||||
@ -669,6 +670,7 @@ do_write(struct bufferevent_openssl *bev_ssl, int atmost)
|
|||||||
if (space[i].iov_len == 0)
|
if (space[i].iov_len == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
ERR_clear_error();
|
||||||
r = SSL_write(bev_ssl->ssl, space[i].iov_base,
|
r = SSL_write(bev_ssl->ssl, space[i].iov_base,
|
||||||
space[i].iov_len);
|
space[i].iov_len);
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
@ -1021,6 +1023,7 @@ do_handshake(struct bufferevent_openssl *bev_ssl)
|
|||||||
return -1;
|
return -1;
|
||||||
case BUFFEREVENT_SSL_CONNECTING:
|
case BUFFEREVENT_SSL_CONNECTING:
|
||||||
case BUFFEREVENT_SSL_ACCEPTING:
|
case BUFFEREVENT_SSL_ACCEPTING:
|
||||||
|
ERR_clear_error();
|
||||||
r = SSL_do_handshake(bev_ssl->ssl);
|
r = SSL_do_handshake(bev_ssl->ssl);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user