Skip to content

Commit

Permalink
Client's connect callback runs with err, remote connection params now
Browse files Browse the repository at this point in the history
  • Loading branch information
timoxley committed Jan 30, 2012
1 parent 5a887eb commit 3c40fc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/client.js
Expand Up @@ -55,7 +55,7 @@ Client.prototype.connect = function(host, callback) {
self.up.once('up', function(remote) { self.up.once('up', function(remote) {
self.ready = true self.ready = true
self.emit('ready', remote, self.connection) self.emit('ready', remote, self.connection)
return callback() return callback(null, remote, self.connection)
}) })
}) })
return this return this
Expand Down
7 changes: 5 additions & 2 deletions tests/client.js
Expand Up @@ -64,9 +64,12 @@ describe('client', function() {
}) })
}) })
}) })
describe('listening on a port', function() { describe('connecting to a port', function() {
it('will use callback when listening on port', function(done) { it('will use callback when listening on port', function(done) {
client = new Client().connect(PORT, function() { client = new Client().connect(PORT, function(err, remote, connection) {
assert.ok(!err)
assert.ok(remote)
assert.ok(connection.id)
done() done()
}) })
}) })
Expand Down

0 comments on commit 3c40fc4

Please sign in to comment.