Permalink
Browse files

undef cons bug fixed, but hangs when passing a cons to connect()

  • Loading branch information...
1 parent bd4ae2d commit 8c9222565dd14f37ca3818a428b0f7ca06d46622 @substack substack committed Apr 9, 2012
Showing with 5 additions and 3 deletions.
  1. +3 −0 index.js
  2. +1 −1 package.json
  3. +1 −2 test/cons.js
View
@@ -174,7 +174,10 @@ function connect (up, cons) {
var res = cons || {};
if (typeof cons === 'function') {
res = cons.call(this, remote, conn);
+ if (res === undefined) res = this;
}
+
+ if (!res) res = {};
if (!res.ping) res.ping = function (cb) {
if (typeof cb === 'function') cb();
};
View
@@ -1,7 +1,7 @@
{
"name" : "upnode",
"description" : "transactional connection queue for dnode",
- "version" : "0.2.0",
+ "version" : "0.2.1",
"repository" : {
"type" : "git",
"url" : "git://github.com/substack/upnode.git"
View
@@ -7,8 +7,7 @@ test('constructor', function (t) {
var up = upnode(function () {
this.beep = 5;
- });
- up.connect(port);
+ }).connect(port);
var server = upnode(function (remote, conn) {
this.boop = 6;

0 comments on commit 8c92225

Please sign in to comment.