diff --git a/lib/net.js b/lib/net.js index e81d82753c0..88e1925ccc3 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1,8 +1,6 @@ var util = require("util"); -var fs = require("fs"); var events = require("events"); var stream = require("stream"); -var dns = require('dns'); var kMinPoolSpace = 128; var kPoolSize = 40*1024; @@ -796,7 +794,7 @@ Stream.prototype.connect = function () { doConnect(self, arguments[0]); } else { // TCP - dns.lookup(arguments[1], function (err, ip, addressType) { + require('dns').lookup(arguments[1], function (err, ip, addressType) { if (err) { self.emit('error', err); } else { @@ -1085,7 +1083,7 @@ Server.prototype.listen = function () { var path = arguments[0]; self.path = path; // unlink sockfile if it exists - fs.stat(path, function (err, r) { + require('fs').stat(path, function (err, r) { if (err) { if (err.errno == ENOENT) { self._doListen(path); @@ -1111,7 +1109,7 @@ Server.prototype.listen = function () { self._doListen(port); } else { // the first argument is the port, the second an IP - dns.lookup(arguments[1], function (err, ip, addressType) { + require('dns').lookup(arguments[1], function (err, ip, addressType) { if (err) { self.emit('error', err); } else { @@ -1192,7 +1190,7 @@ Server.prototype.close = function () { } if (self.type === "unix") { - fs.unlink(self.path, function () { + require('fs').unlink(self.path, function () { self.emit("close"); }); } else {