Add another CoreVersion field specifically for StatisticsManager (ticket #2729)

This commit is contained in:
zzz
2020-05-08 12:21:26 +00:00
parent d49741c2db
commit eeecede382
2 changed files with 26 additions and 31 deletions

View File

@ -10,7 +10,9 @@ package net.i2p;
*/ */
/** /**
* Expose a version string * Expose a version string.
*
* See also: RouterVersion, VersionComparator, and the update subsystem.
* *
*/ */
public class CoreVersion { public class CoreVersion {
@ -18,7 +20,28 @@ public class CoreVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = "0.9.45"; /**
* The version published in the netdb via StatisticsManager.
* If we ever need a point release for a specific
* architecture only, append ".1" to VERSION
* and leave PUBLISHED_VERSION unchanged.
* Otherwise, the same as VERSION.
* RouterVersion.FULL_VERSION is suggested for display to the user.
*
* @since 0.9.46
*/
public final static String PUBLISHED_VERSION = "0.9.45";
/**
* The version used when checking for router updates,
* and exchanged between router and client over I2CP.
* If we ever need a point release for a specific
* architecture only, append ".1" to VERSION
* and leave PUBLISHED_VERSION unchanged.
* Otherwise, the same as PUBLISHED_VERSION.
* RouterVersion.FULL_VERSION is suggested for display to the user.
*/
public final static String VERSION = PUBLISHED_VERSION;
/** /**
* For Vuze. * For Vuze.

View File

@ -70,38 +70,10 @@ public class StatisticsManager {
*/ */
public Properties publishStatistics(Hash h) { public Properties publishStatistics(Hash h) {
Properties stats = new Properties(); Properties stats = new Properties();
stats.setProperty("router.version", RouterVersion.VERSION); stats.setProperty("router.version", CoreVersion.PUBLISHED_VERSION);
// never used
//stats.setProperty("coreVersion", CoreVersion.VERSION);
stats.setProperty(RouterInfo.PROP_NETWORK_ID, _networkID); stats.setProperty(RouterInfo.PROP_NETWORK_ID, _networkID);
stats.setProperty(RouterInfo.PROP_CAPABILITIES, _context.router().getCapabilities()); stats.setProperty(RouterInfo.PROP_CAPABILITIES, _context.router().getCapabilities());
// No longer expose, to make build tracking more expensive
// stats.setProperty("router.id", RouterVersion.ID);
// stats.setProperty("core.id", CoreVersion.ID);
/***
int newlines = 0;
FileInputStream in = null;
try {
in = new FileInputStream(Router.IDENTLOG);
int c = -1;
// perhaps later filter this to only include ident changes this
// day/week/month
while ( (c = in.read()) != -1) {
if (c == '\n')
newlines++;
}
} catch (IOException ioe) {
// ignore
} finally {
if (in != null)
try { in.close(); } catch (IOException ioe) {}
}
if (newlines > 0)
stats.setProperty("stat_identities", newlines+"");
***/
if (_context.getBooleanPropertyDefaultTrue(PROP_PUBLISH_RANKINGS) && if (_context.getBooleanPropertyDefaultTrue(PROP_PUBLISH_RANKINGS) &&
_context.random().nextInt(RANDOM_INCLUDE_STATS) == 0) { _context.random().nextInt(RANDOM_INCLUDE_STATS) == 0) {
//long publishedUptime = _context.router().getUptime(); //long publishedUptime = _context.router().getUptime();