max number of retries for ack was not needed
This commit is contained in:
parent
57952d817a
commit
d7d9ba242e
@ -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;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user