Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed incorrect RetransmitTable.getNullMessages(), and added a test t…

…o RetransmitTableTest
  • Loading branch information...
commit 4706a2275e517174b2fb3de3506fe0a53bc5b8db 1 parent bbc1284
@belaban authored
View
2  src/org/jgroups/util/RetransmitTable.java
@@ -351,7 +351,7 @@ public int getNullMessages(long from, long to) {
if(row_index < 0 || row_index >= matrix.length)
continue;
Message[] row=matrix[row_index];
- if(row != null && row[computeIndex(i)] == null)
+ if(row == null || row[computeIndex(i)] == null)
retval++;
}
return retval;
View
9 tests/junit-functional/org/jgroups/tests/RetransmitTableTest.java
@@ -111,6 +111,15 @@ public static void testRemove() {
assert num_null_msgs == 15;
}
+ public static void testGetNullMessages() {
+ RetransmitTable table=new RetransmitTable(3, 10, 0);
+ table.put(1, MSG);
+ table.put(100, MSG);
+ System.out.println("table = " + table);
+ int num_null_elements=table.getNullMessages(0, 100);
+ assert num_null_elements == 98; // [1 .. 99] excluding 100, as it has been received
+ }
+
public static void testDumpMatrix() {
RetransmitTable table=new RetransmitTable(3, 10, 1);
long[] seqnos={1,3,5,7,9,12,14,16,18,20,21,22,23,24};
Please sign in to comment.
Something went wrong with that request. Please try again.