How to use the mdns.kDNSServiceErr_Unknown function in mdns

To help you get started, we’ve selected a few mdns examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github citelab / JAMScript / lib / jdiscovery / mdnsregistry.js View on Github external
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);
github citelab / JAMScript / lib / jserver / mdnsregistration.js View on Github external
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);
    }
}
github DefinitelyTyped / DefinitelyTyped / mdns / mdns-tests.ts View on Github external
function handleError(error:MDNS.DnsSdError) {
    switch (error.errorCode) {
        case mdns.kDNSServiceErr_Unknown:
            console.warn(error);
            setTimeout(createAdvertisement, 5000);
            break;
        default:
            throw error;
    }
}
github NorthernMan54 / homebridge-alexa / lib / HAPInterface.js View on Github external
function handleError(err) {
  switch (err.errorCode) {
    case mdns.kDNSServiceErr_Unknown:
      console.warn(err);
      setTimeout(createBrowser, 5000);
      break;
    default:
      console.warn(err);
  }
}