cache secureContext

This commit is contained in:
AJ ONeal 2016-10-07 12:00:21 -06:00
parent 51249791aa
commit cb898418f2
1 changed files with 5 additions and 1 deletions

View File

@ -132,6 +132,7 @@ function run() {
// letsencrypt
var cert = require('localhost.daplie.com-certificates').merge({});
var secureContext;
var opts = {
agreeTos: argv.agreeTos || argv['agree-tos']
@ -147,7 +148,10 @@ function run() {
var peerCa;
opts.httpsOptions.SNICallback = function (servername, cb) {
cb(null, tls.createSecureContext(opts.httpsOptions));
if (!secureContext) {
secureContext = tls.createSecureContext(opts.httpsOptions);
}
cb(null, secureContext);
return;
};