Permalink
Browse files

emit secure instead of secureConnection to avoid node 0.6 issues

  • Loading branch information...
1 parent 3020ce8 commit 70361f0972bae12187e8c9adec4cbf29b2a20f03 @substack committed Feb 3, 2012
Showing with 8 additions and 8 deletions.
  1. +1 −1 README.markdown
  2. +2 −2 index.js
  3. +5 −5 test/tls.js
View
2 README.markdown
@@ -263,7 +263,7 @@ will be emitted as an `'error'` event on the stream object but you can provide
your own authorization logic by doing:
``` js
-stream.on('secureConnect', function (ack) {
+stream.on('secure', function (ack) {
if (...) ack.accept()
else ack.reject()
})
View
4 index.js
@@ -37,7 +37,7 @@ exports.connect = function () {
}
else if (tlsOpts) {
stream = tls.connect(port, host, tlsOpts, function () {
- var pending = stream.listeners('secureConnect').length;
+ var pending = stream.listeners('secure').length;
var allOk = pending === 0 ? stream.authorized : true;
if (pending === 0) done()
else {
@@ -51,7 +51,7 @@ exports.connect = function () {
if (--pending === 0) done();
}
};
- stream.emit('secureConnect', ack);
+ stream.emit('secure', ack);
}
function done () {
View
10 test/tls.js
@@ -22,7 +22,7 @@ function makeServer () {
return server;
}
-test('TLS - unauthorized', {timeout: 1000}, function(t) {
+test('TLS - unauthorized', function (t) {
t.plan(2);
var options = { tls: true };
var server = makeServer();
@@ -41,7 +41,7 @@ test('TLS - unauthorized', {timeout: 1000}, function(t) {
});
});
-test('TLS - unauthorized with callback', {timeout: 1000}, function(t) {
+test('TLS - unauthorized with callback', function (t) {
t.plan(3);
var server = makeServer();
@@ -56,14 +56,14 @@ test('TLS - unauthorized with callback', {timeout: 1000}, function(t) {
})
});
- c.on('secureConnect', function (ack) {
+ c.on('secure', function (ack) {
t.ok(!c.authorized);
ack.accept();
});
});
});
-test('TLS - authorized', {timeout: 1000}, function(t) {
+test('TLS - authorized', function (t) {
t.plan(3);
var server = makeServer();
@@ -81,7 +81,7 @@ test('TLS - authorized', {timeout: 1000}, function(t) {
})
});
- c.on('secureConnect', function (ack) {
+ c.on('secure', function (ack) {
t.ok(c.authorized, "should be authorized");
if (c.authorized) ack.accept()
else ack.reject()

0 comments on commit 70361f0

Please sign in to comment.