* DataHelper: Fix broken byte[] compareTo() used by XORComparator,
was not doing unsigned comparisons! * Floodfill rework part 2 of N: Store closest to the key, subject to last failed lookup and store stats. * FloodfillPeerSelector: Use standard XORComparator instead of messing with BigInteger * FloodfillVerifyStoreJob: Set correct timeout for requeued store job * KNDF: Rework getPeerTimout() to use 1 day averages, and lower the min, max, and multiplication factor. * Publish jobs: Lengthen timeout to 90s (was 30s for routerinfos and 60s for leasesets) * StoreJob: Limit max peer timeout to 15s for direct stores
This commit is contained in:
@ -722,6 +722,7 @@ public class DataHelper {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** treat bytes as unsigned */
|
||||
public final static int compareTo(byte lhs[], byte rhs[]) {
|
||||
if ((rhs == null) && (lhs == null)) return 0;
|
||||
if (lhs == null) return -1;
|
||||
@ -729,9 +730,9 @@ public class DataHelper {
|
||||
if (rhs.length < lhs.length) return 1;
|
||||
if (rhs.length > lhs.length) return -1;
|
||||
for (int i = 0; i < rhs.length; i++) {
|
||||
if (rhs[i] > lhs[i])
|
||||
if ((rhs[i] & 0xff) > (lhs[i] & 0xff))
|
||||
return -1;
|
||||
else if (rhs[i] < lhs[i]) return 1;
|
||||
else if ((rhs[i] & 0xff) < (lhs[i] & 0xff)) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user