Home › Forums › PeerfactSim Forum › AbstractChordNode returning the wrong neighbors
- This topic has 2 replies, 1 voice, and was last updated 9 years, 5 months ago by Thim Strothmann.
-
AuthorPosts
-
May 21, 2015 at 8:30 pm #954DennisGuest
While trying to understand the ReplicationDHTService I noticed that
the neighbors set of a ChordNode obtained through the getNeighbors()
(AbstractChordNode) method was always empty. The ChordNode class has
it’s own routingTable variable which hides the routingTable variable
of the AbstractChordNode class. The routingTable variable of the
AbstractChordNode class remains null throughout the simulation. But
the getNeighbors() method in the AbstractChordNode class looks like
this:public INeighborDeterminator getNeighbors() {
return new INeighborDeterminator() {@Override
public Collection<OverlayContact> getNeighbors() {
if (routingTable == null)
return Collections.emptySet();
return routingTable.getNeighbors();
}
};
}
The new INeighborDeterminator will always return an empty set since
the routingTable variable is not used by the ChordNode class. I think
this problem could be resolved by using the getter for the routing
table. This way it is possible to get content of the routingTable
variable of the ChordNode class.
Am I right that the current implementation is wrong?
Does anybody see any issues with my proposed fix for this problem?I’m talking about the ChordNode class from the package
de.tud.kom.p2psim.impl.overlay.dht.chord.chord.components.May 21, 2015 at 8:31 pm #955KalmanGuestSorry for the late answer,
the problem seems to exist and your workaround helps.
Good point, you idea will be included in the next version of the
simulator.May 21, 2015 at 8:31 pm #956Thim StrothmannGuestFor everybody who has the same problem as Dennis (not everybody should
run into this problem), here the work-around, just replace the method
Dennis mentioned with the following one:public INeighborDeterminator getNeighbors() {
return new INeighborDeterminator() {@Override
public Collection<OverlayContact> getNeighbors() {
if (getChordRoutingTable() == null)
return Collections.emptySet();
return getChordRoutingTable().getNeighbors();
}
}; -
AuthorPosts
- You must be logged in to reply to this topic.