diff --git a/lib/tls.js b/lib/tls.js index db6807e06c..a951c979f1 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -170,7 +170,11 @@ CryptoStream.prototype.end = function(d) { CryptoStream.prototype.destroySoon = function(err) { - return this.end(); + if (this.writable) { + this.end(); + } else { + this.destroy(); + } };