diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-10-18 10:07:49 -0700 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2013-10-18 10:07:49 -0700 |
commit | 78fe7d0592c53cd0a0c77f32320979eec5d7fadb (patch) | |
tree | e52519207986a7ed3ac9e1e558b9b845f5924135 | |
parent | c421a5e66b6810315fe2bc713f532886002bd7cc (diff) | |
download | node-78fe7d0592c53cd0a0c77f32320979eec5d7fadb.tar.gz |
crypto: clear openssl error stack when handled
Clear OpenSSL's error stack on return from Connection::HandleSSLError().
This stops stale errors from popping up later in the lifecycle of the
SSL connection where they would cause spurious failures.
This commit causes a 1-2% performance regression on `make bench-tls`.
We'll address that in follow-up commits if possible but let's ensure
correctness first.
Backport of c6e2db2
-rw-r--r-- | src/node_crypto.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 316f4359f..bc22dbe10 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -711,6 +711,9 @@ int Connection::HandleBIOError(BIO *bio, const char* func, int rv) { int Connection::HandleSSLError(const char* func, int rv) { + ClearErrorOnReturn clear_error_on_return; + (void) &clear_error_on_return; // Silence unused variable warning. + if (rv >= 0) return rv; int err = SSL_get_error(ssl_, rv); |