Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created September 9, 2011 16:14
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 bnoordhuis/cf200af99b4ae26eb5a1 to your computer and use it in GitHub Desktop.
Save bnoordhuis/cf200af99b4ae26eb5a1 to your computer and use it in GitHub Desktop.
diff --git a/lib/tls.js b/lib/tls.js
index 63d6bd0..96074c5 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -679,6 +679,8 @@ SecurePair.prototype.destroy = function() {
self.cleartext.writable = self.cleartext.readable = false;
process.nextTick(function() {
+ self.encrypted.emit('end');
+ self.cleartext.emit('end');
self.encrypted.emit('close');
self.cleartext.emit('close');
});
@@ -1017,7 +1019,7 @@ function pipe(pair, socket) {
function onclose() {
socket.removeListener('error', onerror);
- socket.removeListener('close', onclose);
+ socket.removeListener('end', onclose);
socket.removeListener('timeout', ontimeout);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment