Project

General

Profile

Actions

Task #4911

open

IBLT::listEntries should initially clear the result sets

Added by Anonymous about 5 years ago. Updated 3 months ago.

Status:
In Progress
Priority:
Low
Assignee:
Target version:
-
Start date:
04/11/2019
Due date:
% Done:

30%

Estimated time:

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

https://github.com/named-data/PSync/blob/0cf4b600e91455ee07c38eb22876aa6b653bc14b/tests/test-iblt.cpp#L159

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.

Actions #1

Updated by Junxiao Shi 3 months ago

  • Status changed from New to In Progress
  • Assignee set to Junxiao Shi
  • % Done changed from 0 to 30
Actions

Also available in: Atom PDF