From ff7aed39fd123d2852ef7502aea8e379de42c1e9 Mon Sep 17 00:00:00 2001 From: Mark Cavage Date: Fri, 26 Aug 2011 16:33:49 -0700 Subject: [PATCH] Fix up client to work in all cases (UDS and TCP) --- lib/client.js | 9 +++++---- package.json | 2 +- tst/laundry.test.js | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/client.js b/lib/client.js index 5cb338a..183fc90 100644 --- a/lib/client.js +++ b/lib/client.js @@ -122,9 +122,9 @@ function Client(options) { this.numConnections = Math.abs(options.numConnections) || 1; this.connections = []; this.currentConnection = 0; - this.connectOptions = options.socketPath ? options.socketPath : { - port: self.url.port, - host: self.url.hostname + this.connectOptions = { + port: self.url ? self.url.port : options.socketPath, + host: self.url ? self.url.hostname : undefined }; this.shutdown = false; @@ -141,7 +141,8 @@ function Client(options) { if (self.secure) { c = tls.connect(self.connectOptions.port, self.connectOptions.host); } else { - c = net.createConnection(self.connectOptions.port, self.connectOptions.host); + c = net.createConnection(self.connectOptions.port, + self.connectOptions.host); } assert.ok(c); diff --git a/package.json b/package.json index 55ce2e8..8a3f86c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "name": "ldapjs", "homepage": "http://ldapjs.org", "description": "LDAP client and server APIs", - "version": "0.1.0", + "version": "0.1.1", "repository": { "type": "git", "url": "git://github.com/mcavage/node-ldapjs.git" diff --git a/tst/laundry.test.js b/tst/laundry.test.js index 6403f92..ee70cc0 100644 --- a/tst/laundry.test.js +++ b/tst/laundry.test.js @@ -20,7 +20,7 @@ test('setup', function(t) { server = ldap.createServer(); t.ok(server); server.listen(SOCKET, function() { - client = client = ldap.createClient({ + client = ldap.createClient({ socketPath: SOCKET }); t.ok(client);