From 62f06fb8854943c8dc0bfe801950f97f31c09e2b Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 9 Mar 2011 10:53:06 -0800 Subject: [PATCH] CryptoStream.prototype.destroySoon shouldn't die if not writable --- lib/tls.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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(); + } };