Home › Forums › PeerfactSim Forum › ChordID.getDistance() returns negative value › Reply To: ChordID.getDistance() returns negative value
I think there is a bigger problem. The method abs() of BigInteger
should work correctly. The problem occurs by using the method
intValue().
BigInteger can contain values which do not fit into a normal integer.
Because of the overflow you get negative values.
To work with it correctly, change the return type of the method to
BigInteger and remove the call of intValue() at the end. You only have
to make two self-explanatory changes in other classes
(de.tud.kom.p2psim.impl.overlay.dht.chord.base.components.AbstractChordContact
and
de.tud.kom.p2psim.impl.overlay.dht.chord.rechord.components.ChordRoutingTable)
to make the code compile clean.
The bug will be fixed in the next simulator version for all users.