diff --git a/ws2012/P2P/uebungen/4/src/node/Ack.java b/ws2012/P2P/uebungen/4/src/node/Ack.java index 83afb02c..3d2a1c61 100644 --- a/ws2012/P2P/uebungen/4/src/node/Ack.java +++ b/ws2012/P2P/uebungen/4/src/node/Ack.java @@ -13,12 +13,6 @@ public class Ack { // timeout in seconds private final int TIMEOUT = 1000; - private final int MAX_RETRIES = 5; - - // the number of times we already sent this ack (IRGENDWANN IST AUCH MAL - // SCHLUSS!) - private int retries = 1; - private int id; private SocketAddress address; private ByteBuffer buf; @@ -79,7 +73,6 @@ public class Ack { @Override public void run() { - retries++; while (notReceived && System.currentTimeMillis() < timeToStop) { try { Thread.sleep(10); @@ -90,19 +83,14 @@ public class Ack { // Timeout hit -> re-send if (notReceived) { - if (retries < MAX_RETRIES) { - try { - LOGGER.log(Level.INFO, - "Absent ack #{0}. Resending to {1}", - new Object[] { id, address.toString() }); - channel.send(buf, address); - startThread(); - } catch (IOException e) { - e.printStackTrace(); - } - } else { - LOGGER.log(Level.SEVERE, "Dropping ack #{0}", - new Object[] { id }); + try { + LOGGER.log(Level.INFO, "Absent ack #{0}. Resending to {1}", + new Object[] { id, address.toString() }); + + channel.send(buf, address); + startThread(); + } catch (IOException e) { + e.printStackTrace(); } } } @@ -111,4 +99,8 @@ public class Ack { notReceived = false; } } + + public SocketAddress getAddresse() { + return address; + } } \ No newline at end of file