summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Simmons <jsimmons@google.com>2011-09-20 16:02:43 -0700
committerJason Simmons <jsimmons@google.com>2011-09-20 16:02:43 -0700
commitb99c4f55163e9c4ac6b123f0e8383b9b9072073b (patch)
tree6852d2279f71679d933491b52f9cb55f0bae66aa
parentcc85bd38e82cb6e41288a2bb90f77ba92d79c9d7 (diff)
downloadjmdns-b99c4f55163e9c4ac6b123f0e8383b9b9072073b.tar.gz
Revert the change to DNS_TTL and fix the renewer's TTL
In a previous change, DNSConstants.DNS_TTL had been changed to reduce the TTL of mDNS services advertised by the A@H broker. Instead of changing this for all users of JmDNS, A@H will use the DNSStateTask.setDefaultTTL internal API to control the TTL. Also, patch the Renewer so that the renewal interval is based on the task's own TTL instead of the hardcoded TTL in DNSConstants. Change-Id: I9f42b98e8088267b38d380edfd8b2e737d00414e
-rw-r--r--src/javax/jmdns/impl/constants/DNSConstants.java4
-rw-r--r--src/javax/jmdns/impl/tasks/state/Renewer.java5
2 files changed, 6 insertions, 3 deletions
diff --git a/src/javax/jmdns/impl/constants/DNSConstants.java b/src/javax/jmdns/impl/constants/DNSConstants.java
index b79400b..2704f94 100644
--- a/src/javax/jmdns/impl/constants/DNSConstants.java
+++ b/src/javax/jmdns/impl/constants/DNSConstants.java
@@ -18,8 +18,8 @@ public final class DNSConstants {
public static final int MDNS_PORT = Integer.parseInt(System.getProperty("net.mdns.port", "5353"));
public static final int DNS_PORT = 53;
- // DNS Records Expiration Time in Seconds
- public static final int DNS_TTL = 25;
+ // One hour expiration time
+ public static final int DNS_TTL = 60 * 60;
public static final int MAX_MSG_TYPICAL = 1460;
public static final int MAX_MSG_ABSOLUTE = 8972;
diff --git a/src/javax/jmdns/impl/tasks/state/Renewer.java b/src/javax/jmdns/impl/tasks/state/Renewer.java
index 1c638d4..f79ee12 100644
--- a/src/javax/jmdns/impl/tasks/state/Renewer.java
+++ b/src/javax/jmdns/impl/tasks/state/Renewer.java
@@ -54,7 +54,10 @@ public class Renewer extends DNSStateTask {
@Override
public void start(Timer timer) {
if (!this.getDns().isCanceling() && !this.getDns().isCanceled()) {
- timer.schedule(this, DNSConstants.ANNOUNCED_RENEWAL_TTL_INTERVAL, DNSConstants.ANNOUNCED_RENEWAL_TTL_INTERVAL);
+ // BEGIN android-changed
+ // Schedule the renewer based on this task's TTL, not the default TTL
+ timer.schedule(this, getTTL() * 500, getTTL() * 500);
+ // END android-changed
}
}