diff --git a/lib/tls.js b/lib/tls.js index db6807e06ce..a951c979f1b 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(); + } };