From f71a31b3d8441dc882b234b281754a269eb9ff05 Mon Sep 17 00:00:00 2001 From: James Halliday Date: Fri, 3 Feb 2012 02:55:52 -0800 Subject: [PATCH] just emit the ack since the stream is already available if listenin for streamConnect --- index.js | 2 +- test/tls.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 251e894..6eb68bc 100644 --- a/index.js +++ b/index.js @@ -51,7 +51,7 @@ exports.connect = function () { if (--pending === 0) done(); } }; - stream.emit('secureConnect', stream, ack); + stream.emit('secureConnect', ack); } function done () { diff --git a/test/tls.js b/test/tls.js index d58c36b..2d6a2dd 100644 --- a/test/tls.js +++ b/test/tls.js @@ -56,8 +56,8 @@ test('TLS - unauthorized with callback', {timeout: 1000}, function(t) { }) }); - c.on('secureConnect', function (s, ack) { - t.ok(!s.authorized); + c.on('secureConnect', function (ack) { + t.ok(!c.authorized); ack.accept(); }); }); @@ -81,9 +81,9 @@ test('TLS - authorized', {timeout: 1000}, function(t) { }) }); - c.on('secureConnect', function (s, ack) { - t.ok(s.authorized, "should be authorized"); - if (s.authorized) ack.accept() + c.on('secureConnect', function (ack) { + t.ok(c.authorized, "should be authorized"); + if (c.authorized) ack.accept() else ack.reject() }); });