diff --git a/lib/https/index.js b/lib/https/index.js index ed44e0a5b..94a869f19 100644 --- a/lib/https/index.js +++ b/lib/https/index.js @@ -98,14 +98,12 @@ function handleWebsocket(socket, clientIp, callback) { options = url.parse(fullUrl); resolveHost(fullUrl, function(ip) { var isWss = options.protocol == 'wss'; - util.domain.run(function() { - reqSocket = (isWss ? tls : net).connect({ - rejectUnauthorized: false, - host: ip, - port: options.port || (isWss ? 443 : 80) - }, pipeData); - abortIfUnavailable(reqSocket); - }); + reqSocket = (isWss ? tls : net).connect({ + rejectUnauthorized: false, + host: ip, + port: options.port || (isWss ? 443 : 80) + }, pipeData); + abortIfUnavailable(reqSocket); }); } diff --git a/lib/util/connect-http.js b/lib/util/connect-http.js index 122d99284..f63dbe87c 100644 --- a/lib/util/connect-http.js +++ b/lib/util/connect-http.js @@ -29,12 +29,10 @@ function connect(options, callback) { var client = http.request(options) .on('connect', function (res, socket, head) { socket.on('error', util.noop); - util.domain.run(function() { - execCallback(null, options.isHttps ? tls.connect({ - rejectUnauthorized: false, - socket: socket - }).on('error', util.noop) : socket); - }); + execCallback(null, options.isHttps ? tls.connect({ + rejectUnauthorized: false, + socket: socket + }).on('error', util.noop) : socket); }).on('error', execCallback); client.end(); return client; diff --git a/lib/util/connect-socks.js b/lib/util/connect-socks.js index b42c9875e..c9f4cee6a 100644 --- a/lib/util/connect-socks.js +++ b/lib/util/connect-socks.js @@ -37,13 +37,11 @@ module.exports = function connect(proxyOptions, callback) { auths: auths }, function(socket) { socket.on('error', util.noop); - util.domain.run(function() { - execCallback(null, isHttps ? tls.connect({ - rejectUnauthorized: false, - socket: socket - }).on('error', util.noop) : socket); - }).on('error', execCallback); - }); + execCallback(null, isHttps ? tls.connect({ + rejectUnauthorized: false, + socket: socket + }).on('error', util.noop) : socket); + }).on('error', execCallback); } catch(err) {//socksv5会限制一些参数的格式 execCallback(err); } diff --git a/lib/util/index.js b/lib/util/index.js index 4b49e8245..16d8f792b 100644 --- a/lib/util/index.js +++ b/lib/util/index.js @@ -12,13 +12,6 @@ var zlib = require('zlib'); var PipeStream = require('pipestream'); var config = require('../../package.json'); var now = Date.now(); -/** - * 如果https请求放长时间了,会抛以下异常 - * see: https://github.com/joyent/node/issues/9272 - */ -var domain = exports.domain = require('domain').create(); -domain.on('error', noop); - var OLD_LOCAL_DATA_PATH = exports.OLD_LOCAL_DATA_PATH = path.join(__dirname, '../../../.whistle data'); var LOCAL_DATA_PATH = exports.LOCAL_DATA_PATH = path.join(__dirname, '../../../' + config.dataDirname);