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:
parent
e03d40957e
commit
f5ba81dc38
|
@ -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;
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue