Commit 1d8bc9b1 authored by afreyssin's avatar afreyssin

Workaround for an issue with reliable connection, a duplicate message should...

Workaround for an issue with reliable connection, a duplicate message should never occur (JORAM-287). Throws an exception, then closes the connection.
parent 4ea6e783
/*
* Copyright (C) 2004 - 2013 ScalAgent Distributed Technologies
* Copyright (C) 2004 - 2018 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -164,8 +164,7 @@ public class ReliableTcpConnection {
synchronized (outputLock) {
doSend(outputCounter, inputCounter, request);
if (!noAckedQueue) {
addPendingMessage(new TcpMessage(
outputCounter, request));
addPendingMessage(new TcpMessage(outputCounter, request));
}
outputCounter++;
}
......@@ -277,6 +276,7 @@ public class ReliableTcpConnection {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, " -> id = " + messageId);
if (!noAckedQueue) {
ackPendingMessages(ackId);
if (obj != null) {
......@@ -293,9 +293,11 @@ public class ReliableTcpConnection {
if (messageId > inputCounter) {
inputCounter = messageId;
return obj;
} else if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG,
" -> already received message: " + messageId + " " + obj);
} else {
logger.log(BasicLevel.WARN, " -> already received message: " + messageId + " " + obj);
// This should never happened, close the connection.
throw new IOException("Duplicate message: " + messageId);
}
}
} else {
if (obj != null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment