Minor fixes and javadocs after review

Set 90 day default for event log
Format clock skew in summary bar
Constant time for password hash check
This commit is contained in:
zzz
2017-11-06 23:45:57 +00:00
parent e281620063
commit 2b8f14f709
10 changed files with 21 additions and 19 deletions

View File

@ -49,7 +49,7 @@ class UpdateHandler implements Updater {
return null;
UpdateRunner update = new UpdateRunner(_context, _mgr, type, method, updateSources);
// set status before thread to ensure UI feedback
_mgr.notifyProgress(update, "<b>" + _mgr._t("Updating") + " I2P</b>");
_mgr.notifyProgress(update, "<b>" + _mgr._t("Updating I2P") + "</b>");
return update;
}
}

View File

@ -259,7 +259,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
if (_isPartial)
return;
long d = currentWrite + bytesTransferred;
String status = "<b>" + _t("Updating") + " I2P</b>";
String status = "<b>" + _t("Updating I2P") + "</b>";
_mgr.notifyProgress(this, status, d, d + bytesRemaining);
}

View File

@ -26,6 +26,7 @@ public class CSSHelper extends HelperBase {
public static final String PROP_DISABLE_REFRESH = "routerconsole.summaryDisableRefresh";
private static final String PROP_XFRAME = "routerconsole.disableXFrame";
public static final String PROP_FORCE_MOBILE_CONSOLE = "routerconsole.forceMobileConsole";
/** @since 0.9.32 */
public static final String PROP_EMBED_APPS = "routerconsole.embedApps";
private static final String _consoleNonce = Long.toString(RandomSource.getInstance().nextLong());

View File

@ -54,7 +54,7 @@ public class EventLogHelper extends FormHandler {
EventLog.WATCHDOG, _x("Watchdog warning")
};
private static final long DAY = 24*60*60*1000L;
private static final long[] _times = { 0, DAY, 7*DAY, 30*DAY, 365*DAY };
private static final long[] _times = { 0, DAY, 7*DAY, 30*DAY, 90*DAY, 365*DAY };
public EventLogHelper() {
super();

View File

@ -335,6 +335,7 @@ class SummaryBarRenderer {
.append(nbsp(_t("Debug")))
.append("</a>\n")
// 7 days
.append("<a href=\"/events?from=604800000\" target=\"_top\" title=\"")
.append(_t("View historical log of router events"))
.append("\">")
@ -491,8 +492,8 @@ class SummaryBarRenderer {
.append(_t("Clock Skew"))
.append(":</b></td>" +
"<td align=\"right\">")
.append(_context.clock().getOffset())
.append(" ms</td></tr>\n" +
.append(DataHelper.formatDuration2(_context.clock().getOffset()))
.append("</td></tr>\n" +
"<tr title=\"")
.append(_t("How much RAM I2P is using / total RAM available to I2P (excludes RAM allocated to the JVM)"))
@ -509,9 +510,7 @@ class SummaryBarRenderer {
/** @since 0.9.32 */
public String renderMemoryBarHTML() {
if (_helper == null) return "";
StringBuilder buf = new StringBuilder(512);
buf.append(_helper.getMemoryBar());
return buf.toString();
return _helper.getMemoryBar();
}
public String renderNetworkReachabilityHTML() {
@ -656,6 +655,7 @@ class SummaryBarRenderer {
return buf.toString();
}
/** @since 0.9.32 */
public String renderPeersAdvancedHTML() {
if (_helper == null) return "";
StringBuilder buf = new StringBuilder(512);

View File

@ -294,9 +294,8 @@ public class SummaryHelper extends HelperBase {
/**
* Retrieve amount of used memory.
*
* @since 0.9.32 uncommented
*/
public String getMemory() {
DecimalFormat integerFormatter = new DecimalFormat("###,###,##0");
long used = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/1024/1024;
@ -308,6 +307,7 @@ public class SummaryHelper extends HelperBase {
return integerFormatter.format(used) + " / " + total + "MB";
}
/** @since 0.9.32 */
public String getMemoryBar() {
DecimalFormat integerFormatter = new DecimalFormat("###,###,##0");
long used = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/1024/1024;
@ -384,11 +384,11 @@ public class SummaryHelper extends HelperBase {
//return _context.profileOrganizer().countWellIntegratedPeers();
return _context.peerManager().getPeersByCapability(FloodfillNetworkDatabaseFacade.CAPABILITY_FLOODFILL).size();
}
/**
* How many peers the router ranks as failing.
*
* @since 0.9.32 uncommented
*/
public int getFailingPeers() {
if (_context == null)
return 0;
@ -397,10 +397,9 @@ public class SummaryHelper extends HelperBase {
}
/**
* How many peers totally suck.
*
* How many peers are banned.
* @since 0.9.32 uncommented
*/
public int getBanlistedPeers() {
if (_context == null)
return 0;
@ -959,7 +958,7 @@ public class SummaryHelper extends HelperBase {
private static final String SS = Character.toString(S);
public List<String> getSummaryBarSections(String page) {
String config = "";
String config;
if ("home".equals(page)) {
config = _context.getProperty(PROP_SUMMARYBAR + page, isAdvanced() ? DEFAULT_MINIMAL_ADVANCED : DEFAULT_MINIMAL);
} else {

View File

@ -387,6 +387,7 @@ class TunnelRenderer {
/**
* Copied from ConfigNetHelper.
* @return in KBytes per second
* @since 0.9.32
*/
private int getShareBandwidth() {
int irateKBps = _context.bandwidthLimiter().getInboundKBytesPerSecond();