Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2010-07-08 17:43:34 -0400
committereutarass2010-07-08 17:43:34 -0400
commitacd51f37b779edb50d5e8ebe069e112a1fd209f6 (patch)
treeb01675f387efb044a249186a8ae43e507e630695 /plugins/org.eclipse.tm.tcf.core
parent8c425ebf21961348cae11f1d0f815e8444a0dbf2 (diff)
downloadorg.eclipse.tcf-acd51f37b779edb50d5e8ebe069e112a1fd209f6.tar.gz
org.eclipse.tcf-acd51f37b779edb50d5e8ebe069e112a1fd209f6.tar.xz
org.eclipse.tcf-acd51f37b779edb50d5e8ebe069e112a1fd209f6.zip
Changed discovery code to recognize and accept without warnings older ACK_SLAVES packets with timestamps in seconds instead of milliseconds
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.core')
-rw-r--r--plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/LocatorService.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/LocatorService.java b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/LocatorService.java
index bbd087e9c..4d8ffbaa0 100644
--- a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/LocatorService.java
+++ b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/local/LocatorService.java
@@ -1010,15 +1010,19 @@ public class LocatorService implements ILocator {
if (port != DISCOVEY_PORT) {
InetAddress addr = getInetAddress(host);
if (addr != null) {
+ long delta = 1000 * 60 * 30; // 30 minutes
long time_now = System.currentTimeMillis();
- long time = timestamp.length() > 0 ? Long.parseLong(timestamp) : time_now;
- if (time < time_now - 600000 || time > time_now + 600000) {
- log("Invalid datagram packet received from " + p.getAddress(),
- new Exception("Invalid slave info timestamp: " + time));
- }
- else {
- addSlave(addr, port, time);
+ long time_val = timestamp.length() > 0 ? Long.parseLong(timestamp) : time_now;
+ if (time_val < time_now - delta || time_val > time_now + delta) {
+ // Some older TCF agents transmit time in seconds instead of milliseconds
+ time_val *= 1000;
+ if (time_val < time_now - delta || time_val > time_now + delta) {
+ log("Invalid datagram packet received from " + p.getAddress(),
+ new Exception("Invalid slave info timestamp: " + timestamp));
+ time_val = time_now;
+ }
}
+ addSlave(addr, port, time_val);
}
}
}

Back to the top