Comparing version 2.5.0-1 to 2.5.0
Changelog | ||
========= | ||
## v.2.5.0 - 15 Mar, 2015 | ||
Same changelog as the pre-release | ||
## v.2.5.0-1 - 07 Mar, 2015 | ||
@@ -5,0 +9,0 @@ |
43
index.js
@@ -37,3 +37,5 @@ 'use strict'; | ||
function RedisClient (options) { | ||
// Attention: The second parameter might be removed at will and is not officially supported. | ||
// Do not rely on this | ||
function RedisClient (options, stream) { | ||
// Copy the options so they are not mutated | ||
@@ -44,3 +46,8 @@ options = utils.clone(options); | ||
var self = this; | ||
if (options.path) { | ||
if (stream) { | ||
// The stream from the outside is used so no connection from this side is triggered but from the server this client should talk to | ||
// Reconnect etc won't work with this. This requires monkey patching to work, so it is not officially supported | ||
options.stream = stream; | ||
this.address = '"Private stream"'; | ||
} else if (options.path) { | ||
cnx_options.path = options.path; | ||
@@ -179,13 +186,21 @@ this.address = options.path; | ||
// On a reconnect destroy the former stream and retry | ||
if (this.stream) { | ||
this.stream.removeAllListeners(); | ||
this.stream.destroy(); | ||
} | ||
if (this.options.stream) { | ||
// Only add the listeners once in case of a reconnect try (that won't work) | ||
if (this.stream) { | ||
return; | ||
} | ||
this.stream = this.options.stream; | ||
} else { | ||
// On a reconnect destroy the former stream and retry | ||
if (this.stream) { | ||
this.stream.removeAllListeners(); | ||
this.stream.destroy(); | ||
} | ||
/* istanbul ignore if: travis does not work with stunnel atm. Therefor the tls tests are skipped on travis */ | ||
if (this.options.tls) { | ||
this.stream = tls.connect(this.connection_options); | ||
} else { | ||
this.stream = net.createConnection(this.connection_options); | ||
/* istanbul ignore if: travis does not work with stunnel atm. Therefor the tls tests are skipped on travis */ | ||
if (this.options.tls) { | ||
this.stream = tls.connect(this.connection_options); | ||
} else { | ||
this.stream = net.createConnection(this.connection_options); | ||
} | ||
} | ||
@@ -224,4 +239,4 @@ | ||
this.stream.once('close', function () { | ||
self.connection_gone('close', new Error('Stream connection closed')); | ||
this.stream.once('close', function (hadError) { | ||
self.connection_gone('close', new Error('Stream connection closed' + (hadError ? ' because of a transmission error' : ''))); | ||
}); | ||
@@ -228,0 +243,0 @@ |
{ | ||
"name": "redis", | ||
"version": "2.5.0-1", | ||
"version": "2.5.0", | ||
"description": "Redis client library", | ||
@@ -42,3 +42,3 @@ "keywords": [ | ||
"mocha": "^2.3.2", | ||
"nyc": "^5.2.0", | ||
"nyc": "^6.0.0", | ||
"optional-dev-dependency": "^1.1.0", | ||
@@ -45,0 +45,0 @@ "tcp-port-used": "^0.1.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
130663
17
1477
0
2