Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjfontaine/7ab373992c16cbe8b4cc to your computer and use it in GitHub Desktop.
Save tjfontaine/7ab373992c16cbe8b4cc to your computer and use it in GitHub Desktop.
From c9a02e427cf92819b99d69b60a038372516a8301 Mon Sep 17 00:00:00 2001
From: Timothy J Fontaine <tjfontaine@gmail.com>
Date: Sun, 23 Jun 2013 22:33:13 +0000
Subject: [PATCH] tls: only wait for finish if we haven't seen it
---
lib/tls.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/tls.js b/lib/tls.js
index 4d222f3..469548a 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -650,7 +650,10 @@ CryptoStream.prototype.destroySoon = function(err) {
if (--waiting === 0) self.destroy();
}
this._opposite.once('end', finish);
- this.once('finish', finish);
+ if (!this._finished)
+ this.once('finish', finish);
+ else
+ --waiting;
}
};
--
1.7.10.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment