@Override public void start(Timer timer) { // According to draft-cheshire-dnsext-multicastdns.txt chapter "7 Responding": // We respond immediately if we know for sure, that we are the only one who can respond to the query. // In all other cases, we respond within 20-120 ms. // // According to draft-cheshire-dnsext-multicastdns.txt chapter "6.2 Multi-Packet Known Answer Suppression": // We respond after 20-120 ms if the query is truncated. boolean iAmTheOnlyOne = true; for (DNSQuestion question : _in.getQuestions()) { if (logger.isLoggable(Level.FINEST)) { logger.finest(this.getName() + "start() question=" + question); } iAmTheOnlyOne = question.iAmTheOnlyOne(this.getDns()); if (!iAmTheOnlyOne) { break; } } int delay = (iAmTheOnlyOne && !_in.isTruncated()) ? 0 : DNSConstants.RESPONSE_MIN_WAIT_INTERVAL + JmDNSImpl.getRandom().nextInt(DNSConstants.RESPONSE_MAX_WAIT_INTERVAL - DNSConstants.RESPONSE_MIN_WAIT_INTERVAL + 1) - _in.elapseSinceArrival(); if (delay < 0) { delay = 0; } if (logger.isLoggable(Level.FINEST)) { logger.finest(this.getName() + "start() Responder chosen delay=" + delay); } if (!this.getDns().isCanceling() && !this.getDns().isCanceled()) { timer.schedule(this, delay); } }
@Override public void start(Timer timer) { // According to draft-cheshire-dnsext-multicastdns.txt chapter "7 Responding": // We respond immediately if we know for sure, that we are the only one who can respond to the query. // In all other cases, we respond within 20-120 ms. // // According to draft-cheshire-dnsext-multicastdns.txt chapter "6.2 Multi-Packet Known Answer Suppression": // We respond after 20-120 ms if the query is truncated. boolean iAmTheOnlyOne = true; for (DNSQuestion question : _in.getQuestions()) { if (logger.isLoggable(Level.FINEST)) { logger.finest(this.getName() + "start() question=" + question); } iAmTheOnlyOne = question.iAmTheOnlyOne(this.getDns()); if (!iAmTheOnlyOne) { break; } } int delay = (iAmTheOnlyOne && !_in.isTruncated()) ? 0 : DNSConstants.RESPONSE_MIN_WAIT_INTERVAL + JmDNSImpl.getRandom().nextInt(DNSConstants.RESPONSE_MAX_WAIT_INTERVAL - DNSConstants.RESPONSE_MIN_WAIT_INTERVAL + 1) - _in.elapseSinceArrival(); if (delay < 0) { delay = 0; } if (logger.isLoggable(Level.FINEST)) { logger.finest(this.getName() + "start() Responder chosen delay=" + delay); } if (!this.getDns().isCanceling() && !this.getDns().isCanceled()) { timer.schedule(this, delay); } }
@Override public void start(Timer timer) { // According to draft-cheshire-dnsext-multicastdns.txt chapter "7 Responding": // We respond immediately if we know for sure, that we are the only one who can respond to the query. // In all other cases, we respond within 20-120 ms. // // According to draft-cheshire-dnsext-multicastdns.txt chapter "6.2 Multi-Packet Known Answer Suppression": // We respond after 20-120 ms if the query is truncated. boolean iAmTheOnlyOne = true; for (DNSQuestion question : _in.getQuestions()) { if (logger.isLoggable(Level.FINEST)) { logger.finest(this.getName() + "start() question=" + question); } iAmTheOnlyOne = question.iAmTheOnlyOne(this.getDns()); if (!iAmTheOnlyOne) { break; } } int delay = (iAmTheOnlyOne && !_in.isTruncated()) ? 0 : DNSConstants.RESPONSE_MIN_WAIT_INTERVAL + JmDNSImpl.getRandom().nextInt(DNSConstants.RESPONSE_MAX_WAIT_INTERVAL - DNSConstants.RESPONSE_MIN_WAIT_INTERVAL + 1) - _in.elapseSinceArrival(); if (delay < 0) { delay = 0; } if (logger.isLoggable(Level.FINEST)) { logger.finest(this.getName() + "start() Responder chosen delay=" + delay); } if (!this.getDns().isCanceling() && !this.getDns().isCanceled()) { timer.schedule(this, delay); } }
@Override public void start(Timer timer) { // According to draft-cheshire-dnsext-multicastdns.txt chapter "7 Responding": // We respond immediately if we know for sure, that we are the only one who can respond to the query. // In all other cases, we respond within 20-120 ms. // // According to draft-cheshire-dnsext-multicastdns.txt chapter "6.2 Multi-Packet Known Answer Suppression": // We respond after 20-120 ms if the query is truncated. boolean iAmTheOnlyOne = true; for (DNSQuestion question : _in.getQuestions()) { logger.trace("{}.start() question={}", this.getName(), question); iAmTheOnlyOne = question.iAmTheOnlyOne(this.getDns()); if (!iAmTheOnlyOne) { break; } } int delay = (iAmTheOnlyOne && !_in.isTruncated()) ? 0 : DNSConstants.RESPONSE_MIN_WAIT_INTERVAL + JmDNSImpl.getRandom().nextInt(DNSConstants.RESPONSE_MAX_WAIT_INTERVAL - DNSConstants.RESPONSE_MIN_WAIT_INTERVAL + 1) - _in.elapseSinceArrival(); if (delay < 0) { delay = 0; } logger.trace("{}.start() Responder chosen delay={}", this.getName(), delay); if (!this.getDns().isCanceling() && !this.getDns().isCanceled()) { timer.schedule(this, delay); } }