Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
MDNSRegistry.prototype._handleError = function(self, err, ad, attr, adName, txtRecord, retries) {
switch (err.errorCode) {
// if the error is unknown, then the mdns daemon may currently be down,
// so try again after some time
case mdns.kDNSServiceErr_Unknown:
logger.log.error('Unknown service error: ' + err);
if (retries === 0) {
logger.log.warning('Exhaused all advertisement retries.');
// make sure the ad is stopped
ad.stop();
// emit the ad info, so the registrar can decide if it wants to retry later
self.emit('ad-error', self, attr, addName, txtRecord);
} else {
setTimeout(self._createAdvertisementWithRetries, constants.mdns.retryInterval, self, attr, adName, txtRecord, retries - 1);
}
break;
default:
logger.log.error('Unhandled service error: ' + err);
// make sure the ad is stopped
ad.stop();
self.emit('ad-error', self, attr, addName, txtRecord);
MDNSRegistrar.prototype._handleError = function(err, retries) {
switch (err.errorCode) {
// if the error is unknown, then the mdns daemon may currently be down,
// so try again in 10 seconds
case mdns.kDNSServiceErr_Unknown:
logger.log.error('Unknown service error: ' + err);
if (retries === 0) {
logger.log.warning('Exhaused all advertisement retries.');
this.emit('mdns-ad-error', err);
} else {
setTimeout(this._createAdvertisement, constants.mdns.retryInterval, retries);
}
break;
default:
logger.log.error('Unhandled service error: ' + err + '. Abandoning mDNS.');
this.emit('mdns-ad-error', err);
}
}
function handleError(error:MDNS.DnsSdError) {
switch (error.errorCode) {
case mdns.kDNSServiceErr_Unknown:
console.warn(error);
setTimeout(createAdvertisement, 5000);
break;
default:
throw error;
}
}
function handleError(err) {
switch (err.errorCode) {
case mdns.kDNSServiceErr_Unknown:
console.warn(err);
setTimeout(createBrowser, 5000);
break;
default:
console.warn(err);
}
}