fixed incorrect node-id distance calculation in DHT
This commit is contained in:
parent
2ed210fd8a
commit
b9073420fc
|
@ -1,3 +1,4 @@
|
|||
* Fixed invalid calculation in DHT node distance
|
||||
* Fixed bug in URL parser that failed to parse IPv6 addresses
|
||||
* added peer download rate approximation
|
||||
* added port filter for outgoing connection (to prevent
|
||||
|
|
|
@ -87,7 +87,7 @@ int distance_exp(node_id const& n1, node_id const& n2)
|
|||
// return the bit-number of the first bit
|
||||
// that differs
|
||||
int bit = byte * 8;
|
||||
for (int b = 7; b > 0; --b)
|
||||
for (int b = 7; b >= 0; --b)
|
||||
if (t >= (1 << b)) return bit + b;
|
||||
return bit;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue