Browse files

improve heuristics

  • Loading branch information...
1 parent 9e238be commit 0aff2d18175ef384161808c66ac2da85d0ad2696 @sipa committed May 30, 2012
Showing with 8 additions and 7 deletions.
  1. +8 −7 db.h
View
15 db.h
@@ -94,10 +94,11 @@ class CAddrInfo {
if (total <= 3 && success * 2 >= total) return true;
- if (stat2H.reliability > 0.7 && stat2H.count > 1) return true;
- if (stat8H.reliability > 0.6 && stat8H.count > 2) return true;
- if (stat1D.reliability > 0.5 && stat1D.count > 4) return true;
- if (stat1W.reliability > 0.4 && stat1W.count > 8) return true;
+ if (stat2H.reliability > 0.85 && stat2H.count > 2) return true;
+ if (stat8H.reliability > 0.70 && stat8H.count > 4) return true;
+ if (stat1D.reliability > 0.55 && stat1D.count > 8) return true;
+ if (stat1W.reliability > 0.45 && stat1W.count > 16) return true;
+ if (stat1M.reliability > 0.35 && stat1M.count > 32) return true;
return false;
}
@@ -108,10 +109,10 @@ class CAddrInfo {
}
int GetIgnoreTime() const {
if (IsGood()) return 0;
- if (stat8H.reliability - stat8H.weight + 1.0 < 0.20 && stat8H.count > 6) { return 1*3600; }
- if (stat1D.reliability - stat1D.weight + 1.0 < 0.16 && stat1D.count > 12) { return 2*3600; }
- if (stat1W.reliability - stat1W.weight + 1.0 < 0.12 && stat8H.count > 24) { return 4*3600; }
if (stat1M.reliability - stat1M.weight + 1.0 < 0.08 && stat1D.count > 48) { return 8*3600; }
+ if (stat1W.reliability - stat1W.weight + 1.0 < 0.12 && stat8H.count > 24) { return 4*3600; }
+ if (stat1D.reliability - stat1D.weight + 1.0 < 0.16 && stat1D.count > 12) { return 2*3600; }
+ if (stat8H.reliability - stat8H.weight + 1.0 < 0.20 && stat8H.count > 6) { return 1*3600; }
return 0;
}

0 comments on commit 0aff2d1

Please sign in to comment.