Lazy load crypto

The whole program is being slowed down by the large CA string in crypto.
Why?
This commit is contained in:
Ryan Dahl 2010-05-04 14:21:01 -07:00
parent afce4c3ae8
commit d044e2de07

View File

@ -1,7 +1,6 @@
var sys = require("sys"); var sys = require("sys");
var fs = require("fs"); var fs = require("fs");
var events = require("events"); var events = require("events");
var crypto= require("crypto");
var dns = require('dns'); var dns = require('dns');
var kMinPoolSpace = 128; var kMinPoolSpace = 128;
@ -422,6 +421,7 @@ Stream.prototype.setSecure = function(credentials) {
if (!have_crypto) { if (!have_crypto) {
throw new Error('node.js not compiled with openssl crypto support.'); throw new Error('node.js not compiled with openssl crypto support.');
} }
var crypto= require("crypto");
this.secure = true; this.secure = true;
this.secureEstablished = false; this.secureEstablished = false;
// If no credentials given, create a new one for just this Stream // If no credentials given, create a new one for just this Stream