Task #4911
openIBLT::listEntries should initially clear the result sets
30%
Description
IBLT::listEntries takes a reference to the positive and negative sets and inserts values:
https://github.com/named-data/PSync/blob/0cf4b600e91455ee07c38eb22876aa6b653bc14b/PSync/detail/iblt.cpp#L148
Normally, listEntries is called with new empty sets. But if the sets are re-used in a future call to listEntries, there could be unexpected side effects.
For example, the following unit test re-uses these sets. Luckily this test still works, even though there could have been unexpected side effects of re-using the sets:
https://github.com/named-data/PSync/blob/0cf4b600e91455ee07c38eb22876aa6b653bc14b/tests/test-iblt.cpp#L150
I suggest that listEntries should first clear the entries, and explain this in the method documentation.
positive.clear();
negative.clear();
This is a low-priority comment because IBLT is only used in the PSync code which always calls listEntries with new empty sets. But it is a small change and could avoid future confusion.