diff --git a/router/java/src/net/i2p/router/Blocklist.java b/router/java/src/net/i2p/router/Blocklist.java index d8802aea8..bdcbb231b 100644 --- a/router/java/src/net/i2p/router/Blocklist.java +++ b/router/java/src/net/i2p/router/Blocklist.java @@ -117,6 +117,7 @@ public class Blocklist { private static final String ID_LOCAL = "local"; private static final String ID_COUNTRY = "country"; private static final String ID_USER = "user"; + public static final String ID_SYBIL = "sybil"; /** diff --git a/router/java/src/net/i2p/router/sybil/Analysis.java b/router/java/src/net/i2p/router/sybil/Analysis.java index 40ed97389..bbcda06aa 100644 --- a/router/java/src/net/i2p/router/sybil/Analysis.java +++ b/router/java/src/net/i2p/router/sybil/Analysis.java @@ -499,6 +499,7 @@ public class Analysis extends JobImpl implements RouterApp { } double avg = total / (sz * sz / 2d); + String other = _context.getBooleanProperty(PROP_NONFF) ? "router" : "floodfill"; for (Pair p : pairs) { double distance = biLog2(p.dist); double point = MIN_CLOSE - distance; @@ -507,10 +508,10 @@ public class Analysis extends JobImpl implements RouterApp { point *= PAIR_DISTANCE_FACTOR; String b2 = p.r2.getHash().toBase64(); addPoints(points, p.r1.getHash(), point, "Very close (" + fmt.format(distance) + - ") to other floodfill " + b2 + ""); + ") to other " + other + " " + b2 + ""); String b1 = p.r1.getHash().toBase64(); addPoints(points, p.r2.getHash(), point, "Very close (" + fmt.format(distance) + - ") to other floodfill " + b1 + ""); + ") to other " + other + " " + b1 + ""); } return avg; } diff --git a/router/java/src/net/i2p/router/sybil/PersistSybil.java b/router/java/src/net/i2p/router/sybil/PersistSybil.java index e864621c9..0c3876735 100644 --- a/router/java/src/net/i2p/router/sybil/PersistSybil.java +++ b/router/java/src/net/i2p/router/sybil/PersistSybil.java @@ -26,6 +26,9 @@ import net.i2p.data.Base64; import net.i2p.data.DataFormatException; import net.i2p.data.DataHelper; import net.i2p.data.Hash; +import net.i2p.router.Blocklist; +import net.i2p.update.UpdateManager; +import net.i2p.update.UpdateType; import net.i2p.util.Log; import net.i2p.util.FileSuffixFilter; import net.i2p.util.SecureDirectory; @@ -241,7 +244,10 @@ public class PersistSybil { Map readBlocklist() { File f = new File(_context.getConfigDir(), SDIR); f = new File(f, BLOCKLIST_SYBIL_FILE); - return readBlocklist(f); + Map rv = readBlocklist(f); + if (rv != null) + notifyVersion(f.lastModified()); + return rv; } /** @@ -319,6 +325,7 @@ public class PersistSybil { out.write(e.getValue().toString()); out.write('\n'); } + notifyVersion(_context.clock().now()); } catch (IOException ioe) { if (_log.shouldWarn()) _log.warn("Error writing the blocklist file", ioe); @@ -327,6 +334,18 @@ public class PersistSybil { } } + /** + * @since 0.9.50 + */ + private void notifyVersion(long v) { + ClientAppManager cmgr = _context.clientAppManager(); + if (cmgr != null) { + UpdateManager umgr = (UpdateManager) cmgr.getRegisteredApp(UpdateManager.APP_NAME); + if (umgr != null) + umgr.notifyInstalled(UpdateType.BLOCKLIST, Blocklist.ID_SYBIL, Long.toString(v)); + } + } + /**** public static void main(String[] args) { I2PAppContext ctx = I2PAppContext.getGlobalContext();