Comparing version 1.1.8 to 1.1.9
@@ -18,2 +18,3 @@ /* | ||
const mod_vasync = require('vasync'); | ||
const mod_verror = require('verror'); | ||
const mod_bunyan = require('bunyan'); | ||
@@ -166,6 +167,12 @@ const mod_resolver = require('./resolver'); | ||
cb(null, self.cf_shadow, self.cf_conn); | ||
} else if (st === 'error' && self.cf_lastError !== undefined) { | ||
self.removeListener('stateChanged', onStateChanged); | ||
var err = new mod_verror.VError(self.cf_lastError, | ||
'Connection error during claim on backend %s:%d', | ||
self.cf_backend.address, self.cf_backend.port); | ||
cb(err); | ||
} else if (st !== 'busy') { | ||
self.removeListener('stateChanged', onStateChanged); | ||
cb(new Error('Claimed connection entered state ' + | ||
st + ' during claim, instead of "busy"')); | ||
cb(new mod_verror.VError('Claimed connection entered ' + | ||
'state "%s" during claim, instead of "busy"', st)); | ||
} | ||
@@ -273,4 +280,2 @@ } | ||
this.cf_conn = undefined; | ||
this.cf_closeAfter = false; | ||
this.cf_lastError = undefined; | ||
this.cf_log.trace('ConnectionFSM closed'); | ||
@@ -277,0 +282,0 @@ S.on(this, 'closeAsserted', function () { }); |
@@ -186,2 +186,4 @@ /* | ||
mod_assert.optionalBool(options._isBootstrap, 'options._isBootstrap'); | ||
this.r_resolvers = options.resolvers || []; | ||
@@ -192,3 +194,12 @@ this.r_domain = options.domain; | ||
this.r_defport = options.defaultPort || 80; | ||
this.r_isBootstrap = false; | ||
if (options._isBootstrap === true) | ||
this.r_isBootstrap = true; | ||
if (this.r_isBootstrap) { | ||
this.r_service = '_dns._udp'; | ||
this.r_defport = 53; | ||
this.r_maxres = 10; | ||
} | ||
mod_assert.optionalObject(options.log, 'options.log'); | ||
@@ -312,7 +323,5 @@ this.r_log = options.log || mod_bunyan.createLogger({ | ||
domain: notIp[0], | ||
service: '_dns._udp', | ||
defaultPort: 53, | ||
log: this.r_log, | ||
recovery: this.r_recovery, | ||
maxDNSConcurrency: 10 | ||
_isBootstrap: true | ||
}); | ||
@@ -350,4 +359,2 @@ this.r_bootstrap = res.r_fsm; | ||
self.r_resolvers.push(srv.address); | ||
if (self.r_bootstrap.r_resolvers.indexOf(srv.address) === -1) | ||
self.r_bootstrap.r_resolvers.push(srv.address); | ||
}); | ||
@@ -361,6 +368,2 @@ this.r_bootstrap.on('removed', function (k) { | ||
self.r_resolvers.splice(idx, 1); | ||
idx = self.r_bootstrap.r_resolvers.indexOf(srv.address); | ||
if (idx !== -1) | ||
self.r_bootstrap.r_resolvers.splice(idx, 1); | ||
}); | ||
@@ -451,3 +454,3 @@ if (this.r_bootstrap.count() > 0) { | ||
} else { | ||
self.r_log.trace(self.r_lastError, | ||
self.r_log.trace({ err: self.r_lastError }, | ||
'repeated error during SRV resolution for service %s, ' + | ||
@@ -583,3 +586,3 @@ 'will retry in 5min', self.r_service); | ||
} else { | ||
self.r_log.trace(self.r_lastError, | ||
self.r_log.trace({ err: self.r_lastError }, | ||
'repeated error during AAAA resolution for name %s, ' + | ||
@@ -686,3 +689,3 @@ 'proceeding', self.r_srv.name); | ||
} else { | ||
self.r_log.debug(self.r_lastError, | ||
self.r_log.debug({ err: self.r_lastError }, | ||
'repeated error during A resolution for name %s, ' + | ||
@@ -705,2 +708,3 @@ 'proceeding', self.r_srv.name); | ||
var newBackends = {}; | ||
var allAddrs = []; | ||
this.r_srvs.forEach(function (srv) { | ||
@@ -716,2 +720,3 @@ srv.addresses = []. | ||
}; | ||
allAddrs.push(addr); | ||
newBackends[srvKey(finalSrv)] = finalSrv; | ||
@@ -757,2 +762,15 @@ }); | ||
if (this.r_isBootstrap) { | ||
var gone = []; | ||
this.r_resolvers.forEach(function (r) { | ||
if (allAddrs.indexOf(r) === -1) | ||
gone.push(r); | ||
}); | ||
this.r_resolvers = allAddrs; | ||
if (gone.length > 0) { | ||
this.r_log.info({ removed: gone }, | ||
'removed %d resolvers from bootstrap', gone.length); | ||
} | ||
} | ||
this.emit('updated'); | ||
@@ -814,10 +832,11 @@ S.gotoState('sleep'); | ||
function NoNameError(name) { | ||
function NoNameError(cause, name) { | ||
if (Error.captureStackTrace) | ||
Error.captureStackTrace(this, NoNameError); | ||
this.name = 'NoNameError'; | ||
this.message = 'No records returned for name ' + name; | ||
this.dnsName = name; | ||
mod_verror.VError.call(this, cause, | ||
'No records returned for name %s', name); | ||
} | ||
mod_util.inherits(NoNameError, Error); | ||
mod_util.inherits(NoNameError, mod_verror.VError); | ||
NoNameError.isInstance = function (i) { | ||
@@ -856,2 +875,6 @@ return (i instanceof NoNameError); | ||
opts.resolvers = this.r_resolvers; | ||
if (this.r_isBootstrap) { | ||
opts.errorThreshold = Math.min( | ||
this.r_maxres, opts.resolvers.length); | ||
} | ||
@@ -892,3 +915,3 @@ var self = this; | ||
if (err && err.code === 'NXDOMAIN') | ||
err = new NoNameError(domain); | ||
err = new NoNameError(err, domain); | ||
if (!err && msg && msg.getAnswers().length === 0) | ||
@@ -895,0 +918,0 @@ err = new NoRecordsError(domain, type); |
{ | ||
"name": "cueball", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "", | ||
@@ -13,3 +13,3 @@ "main": "lib/index.js", | ||
"mooremachine": ">=2.0.0 <3.0.0", | ||
"mname-client": ">=0.3.6 <0.4.0", | ||
"mname-client": ">=0.5.0 <0.6.0", | ||
"node-uuid": ">=1.4.7 <2.0.0", | ||
@@ -16,0 +16,0 @@ "posix-getopt": ">=1.2.0 <2.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
154258
3724
+ Addedmname-client@0.5.1(transitive)
- Removedmname-client@0.3.7(transitive)
Updatedmname-client@>=0.5.0 <0.6.0