aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2015-04-27 09:39:48 +0200
committerFedor Indutny <fedor@indutny.com>2015-04-30 11:02:30 +0200
commit178741637693a95f9e81200b486df2e6aee06986 (patch)
treebe7fe6a983369a6baa95c96808dcabab7a0ddd80 /lib
parent2684c902c4ff90711e57e787c5bfe0bac33bcd49 (diff)
downloadandroid-node-v8-178741637693a95f9e81200b486df2e6aee06986.tar.gz
android-node-v8-178741637693a95f9e81200b486df2e6aee06986.tar.bz2
android-node-v8-178741637693a95f9e81200b486df2e6aee06986.zip
tls: destroy singleUse context immediately
Destroy singleUse context right after it is going out of use. Fix: https://github.com/iojs/io.js/issues/1522 PR-URL: https://github.com/iojs/io.js/pull/1529 Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
Diffstat (limited to 'lib')
-rw-r--r--lib/_tls_common.js4
-rw-r--r--lib/_tls_wrap.js4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/_tls_common.js b/lib/_tls_common.js
index 3040b3a5b4..d857717dab 100644
--- a/lib/_tls_common.js
+++ b/lib/_tls_common.js
@@ -134,8 +134,10 @@ exports.createSecureContext = function createSecureContext(options, context) {
}
// Do not keep read/write buffers in free list
- if (options.singleUse)
+ if (options.singleUse) {
+ c.singleUse = true;
c.context.setFreeListLength(0);
+ }
return c;
};
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js
index 7f83e2f759..122c7042a4 100644
--- a/lib/_tls_wrap.js
+++ b/lib/_tls_wrap.js
@@ -301,7 +301,9 @@ TLSSocket.prototype._wrapHandle = function(handle) {
};
TLSSocket.prototype._destroySSL = function _destroySSL() {
- return this.ssl.destroySSL();
+ this.ssl.destroySSL();
+ if (this.ssl._secureContext.singleUse)
+ this.ssl._secureContext.context.close();
};
TLSSocket.prototype._init = function(socket, wrap) {