Minor update to ClientPool event pass-through

- Allow event pass-through when performing ClientPool.bind
- Rename createPool parameter for better readability
- Fix jsstyle error
This commit is contained in:
Patrick Mooney 2013-11-28 14:08:17 -06:00
parent e03d40957e
commit f5ba81dc38
2 changed files with 5 additions and 5 deletions

View File

@ -163,7 +163,7 @@ function setupSocket(socket, opts) {
socket.on('error', function onError(err) { socket.on('error', function onError(err) {
if (log.trace()) if (log.trace())
log.trace({err: err}, 'error event: %s', new Error().stack); log.trace({err: err}, 'error event: %s', new Error().stack);
if (opts.connectTimer) { if (opts.connectTimer) {
clearTimeout(opts.connectTimer); clearTimeout(opts.connectTimer);
opts.connectTimer = false; opts.connectTimer = false;

View File

@ -31,7 +31,7 @@ var RETURN_VAL_OPS = [
///--- Internal Functions ///--- Internal Functions
function createPool(options, self) { function createPool(options, clientpool) {
assert.ok(options); assert.ok(options);
return pooling.createPool({ return pooling.createPool({
@ -47,13 +47,13 @@ function createPool(options, self) {
client.on('error', function (err) { client.on('error', function (err) {
client.removeAllListeners('connect'); client.removeAllListeners('connect');
client.removeAllListeners('connectTimeout'); client.removeAllListeners('connectTimeout');
self.emit('error', err); clientpool.emit('error', err);
return callback(err); return callback(err);
}); });
client.on('connectTimeout', function () { client.on('connectTimeout', function () {
client.removeAllListeners('connect'); client.removeAllListeners('connect');
self.emit('connectTimeout'); clientpool.emit('connectTimeout');
}); });
client.once('connect', function onConnect() { client.once('connect', function onConnect() {
@ -248,7 +248,7 @@ ClientPool.prototype.bind = function bind(dn, creds, controls, callback) {
self.options.bindControls = null; self.options.bindControls = null;
return this.pool.shutdown(function () { return this.pool.shutdown(function () {
self.pool = createPool(self.options); self.pool = createPool(self.options, self);
return self.pool.acquire(function onAcquire(err, client) { return self.pool.acquire(function onAcquire(err, client) {
if (err) if (err)