Don't use exponential backoff between multicast packets.

This commit is contained in:
akwizgran
2013-04-14 15:37:57 +01:00
parent a91f3cdf17
commit e83f6bbbc0

View File

@@ -42,6 +42,7 @@ class LanTcpPlugin extends TcpPlugin {
private static final Logger LOG = private static final Logger LOG =
Logger.getLogger(LanTcpPlugin.class.getName()); Logger.getLogger(LanTcpPlugin.class.getName());
private static final int MULTICAST_INTERVAL = 1000; // 1 second
private final Clock clock; private final Clock clock;
@@ -275,8 +276,7 @@ class LanTcpPlugin extends TcpPlugin {
packet.setPort(mcast.getPort()); packet.setPort(mcast.getPort());
long now = clock.currentTimeMillis(); long now = clock.currentTimeMillis();
long end = now + timeout; long end = now + timeout;
long interval = 1000; long nextPacket = now + MULTICAST_INTERVAL;
long nextPacket = now + 1;
try { try {
while(now < end) { while(now < end) {
try { try {
@@ -289,8 +289,7 @@ class LanTcpPlugin extends TcpPlugin {
if(now < end) { if(now < end) {
ms.send(packet); ms.send(packet);
now = clock.currentTimeMillis(); now = clock.currentTimeMillis();
nextPacket = now + interval; nextPacket = now + MULTICAST_INTERVAL;
interval += 1000;
} }
} }
if(!running) return null; if(!running) return null;