Fix up client to work in all cases (UDS and TCP)

This commit is contained in:
Mark Cavage 2011-08-26 16:33:49 -07:00
parent ae0aeee761
commit ff7aed39fd
3 changed files with 7 additions and 6 deletions

View File

@ -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);

View File

@ -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"

View File

@ -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);