0.5.2 broke pooled SSL

This commit is contained in:
Mark Cavage 2012-07-10 22:40:34 +00:00
parent 0da050009b
commit 9d984b72fc
3 changed files with 15 additions and 9 deletions

View File

@ -703,12 +703,12 @@ Client.prototype._connect = function _connect() {
var socket = null; var socket = null;
var timer = false; var timer = false;
socket = proto.connect((this.port || this.socketPath), this.host); function onConnect() {
if (timer)
socket.once('connect', function onConnect() {
if (timer)
clearTimeout(timer); clearTimeout(timer);
socket.removeListener('connect', onConnect);
socket.removeListener('secureConnect', onConnect);
assert.ok(socket.ldap); assert.ok(socket.ldap);
socket.ldap.id = nextClientId() + '__' + socket.ldap.id; socket.ldap.id = nextClientId() + '__' + socket.ldap.id;
@ -718,8 +718,12 @@ Client.prototype._connect = function _connect() {
self.socket = socket; self.socket = socket;
self.emit('connect', socket); self.emit('connect', socket);
}); }
socket = proto.connect((this.port || this.socketPath), this.host);
socket.once('connect', onConnect);
socket.once('secureConnect', onConnect);
setupSocket(socket, this); setupSocket(socket, this);
if (this.connectTimeout) { if (this.connectTimeout) {

View File

@ -76,11 +76,13 @@ function createPool(options) {
return callback(err); return callback(err);
res.on('error', function (e) { res.on('error', function (e) {
return callback(e); removeAllListeners('end');
callback(e);
}); });
return res.on('end', function () { res.on('end', function () {
return callback(null); removeAllListeners('error');
callback(null);
}); });
}); });
}, },

View File

@ -10,7 +10,7 @@
"name": "ldapjs", "name": "ldapjs",
"homepage": "http://ldapjs.org", "homepage": "http://ldapjs.org",
"description": "LDAP client and server APIs", "description": "LDAP client and server APIs",
"version": "0.5.2", "version": "0.5.3",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/mcavage/node-ldapjs.git" "url": "git://github.com/mcavage/node-ldapjs.git"