fixed incorrect node-id distance calculation in DHT

This commit is contained in:
Arvid Norberg 2007-11-19 07:21:38 +00:00
parent 2ed210fd8a
commit b9073420fc
2 changed files with 2 additions and 1 deletions

View File

@ -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

View File

@ -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;
}