almgong / NDNOverWifiDirect

1 stars 0 forks source link

Issue with inconsistent state of peersMap and NFD #34

Closed almgong closed 7 years ago

almgong commented 7 years ago

As seen in the issue #31(timeout mechanism), there are certain interactions that can lead to the NFD destroying faces that makes the current timeout mechanism for removing peers incorrect (peers that left may never be removed from peersMap).

A potential solution is as such: add to the DiscoverPeersRunnable (discoverPeers runnable) some logic that will enumerate all current faces. Add all URIs to a set, and iterate through the peersMap. For all missing uris (which can be easily reconstructed) found in the peersMap, remove them as this means the NFD had destroyed that face for one reason or another.

almgong commented 7 years ago

Changed name of main wrapper method, start/stopDiscoverAndProbe to simply start() and stop(). For separation of concerns, it's probably best not to bundle the face consistency check for DiscoverPeers, and just to create a new runnable with this logic.

almgong commented 7 years ago

Complete.