Refactor the patch to limit its scope to bind actions
This way, other tests keep passing
This commit is contained in:
parent
53d6b36bb2
commit
d702c455bd
|
@ -120,10 +120,6 @@ function Client (options) {
|
||||||
|
|
||||||
this.log = options.log.child({ clazz: 'Client' }, true)
|
this.log = options.log.child({ clazz: 'Client' }, true)
|
||||||
|
|
||||||
this.on('error', function (err) {
|
|
||||||
self.cb(err)
|
|
||||||
})
|
|
||||||
|
|
||||||
this.timeout = parseInt((options.timeout || 0), 10)
|
this.timeout = parseInt((options.timeout || 0), 10)
|
||||||
this.connectTimeout = parseInt((options.connectTimeout || 0), 10)
|
this.connectTimeout = parseInt((options.connectTimeout || 0), 10)
|
||||||
this.idleTimeout = parseInt((options.idleTimeout || 0), 10)
|
this.idleTimeout = parseInt((options.idleTimeout || 0), 10)
|
||||||
|
@ -172,18 +168,6 @@ function Client (options) {
|
||||||
util.inherits(Client, EventEmitter)
|
util.inherits(Client, EventEmitter)
|
||||||
module.exports = Client
|
module.exports = Client
|
||||||
|
|
||||||
/**
|
|
||||||
* Default handler for error callbacks when
|
|
||||||
* one isn't set in the instance
|
|
||||||
*/
|
|
||||||
Client.prototype.cb = function (err, ret) {
|
|
||||||
if (err) {
|
|
||||||
this.log.error('Caught exception:', err)
|
|
||||||
} else {
|
|
||||||
this.log.info('Unhandled output:', ret)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends an abandon request to the LDAP server.
|
* Sends an abandon request to the LDAP server.
|
||||||
*
|
*
|
||||||
|
@ -298,13 +282,15 @@ Client.prototype.bind = function bind (name,
|
||||||
controls: controls
|
controls: controls
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// While we are binding to the server, register the callback as error handler
|
||||||
var self = this
|
var self = this
|
||||||
this.cb = function (err, ret) {
|
function callbackWrapper (err, ret) {
|
||||||
delete self.cb
|
self.removeListener('error', callbackWrapper)
|
||||||
callback(err, ret)
|
callback(err, ret)
|
||||||
}
|
}
|
||||||
|
this.addListener('error', callbackWrapper)
|
||||||
|
|
||||||
return this._send(req, [errors.LDAP_SUCCESS], null, callback, _bypass)
|
return this._send(req, [errors.LDAP_SUCCESS], null, callbackWrapper, _bypass)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue