* Console, EventLog: Added {BECAME,NOT}_FLOODFILL events. They will now be shown on the console's /events page when the router's ff status changes.

* EventLog: Fix a minor typo.
This commit is contained in:
dg2-new
2014-08-13 21:29:17 +00:00
parent eb97ef4cb2
commit d5edcbc6e1
4 changed files with 15 additions and 3 deletions

View File

@ -32,6 +32,7 @@ public class EventLogHelper extends FormHandler {
private static final String ALL = "all";
private static final String[] _events = new String[] {
EventLog.ABORTED, _x("Aborted startup"),
EventLog.BECAME_FLOODFILL, _x("Enabled floodfill"),
EventLog.CHANGE_IP, _x("Changed IP"),
EventLog.CHANGE_PORT, _x("Changed port"),
EventLog.CLOCK_SHIFT, _x("Clock shifted"),
@ -41,6 +42,7 @@ public class EventLogHelper extends FormHandler {
EventLog.INSTALL_FAILED, _x("Install failed"),
EventLog.NETWORK, _x("Network error"),
EventLog.NEW_IDENT, _x("New router identity"),
EventLog.NOT_FLOODFILL, _x("Disabled floodfill"),
EventLog.OOM, _x("Out of memory error"),
EventLog.REKEYED, _x("New router identity"),
EventLog.RESEED, _x("Reseeded router"),

View File

@ -1,6 +1,7 @@
2014-08-13 zzz
2014-08-13 zzz, dg
* Console: Escaping fix (ticket #1346)
* i2psnark: Fix add torrent NPE
* Console, EventLog: add BECAME_FLOODFILL and NOT_FLOODFILL, they are now shown at the /events page when the router changes its floodfill state
2014-08-10 zzz
Prop from i2p.i2p.zzz.snarkconfig:

View File

@ -9,6 +9,7 @@ import net.i2p.router.JobImpl;
import net.i2p.router.Router;
import net.i2p.router.RouterContext;
import net.i2p.router.peermanager.PeerProfile;
import net.i2p.router.util.EventLog;
import net.i2p.util.Log;
/**
@ -42,8 +43,14 @@ class FloodfillMonitorJob extends JobImpl {
boolean wasFF = _facade.floodfillEnabled();
boolean ff = shouldBeFloodfill();
_facade.setFloodfillEnabled(ff);
if (ff != wasFF)
if (ff != wasFF) {
if(ff) {
getContext().router().eventLog().addEvent(EventLog.BECAME_FLOODFILL);
} else {
getContext().router().eventLog().addEvent(EventLog.NOT_FLOODFILL);
}
getContext().router().rebuildRouterInfo();
}
if (_log.shouldLog(Log.INFO))
_log.info("Should we be floodfill? " + ff);
int delay = (REQUEUE_DELAY / 2) + getContext().random().nextInt(REQUEUE_DELAY);

View File

@ -32,15 +32,17 @@ public class EventLog {
/** for convenience, not required */
public static final String ABORTED = "aborted";
public static final String BECAME_FLOODFILL = "becameFloodfill";
public static final String CHANGE_IP = "changeIP";
public static final String CHANGE_PORT = "changePort";
public static final String CLOCK_SHIFT = "clockShift";
public static final String CRASHED = "crashed";
public static final String CRITICAL = "critical";
public static final String INSTALLED = "installed";
public static final String INSTALL_FAILED = "intallFailed";
public static final String INSTALL_FAILED = "installFailed";
public static final String NETWORK = "network";
public static final String NEW_IDENT = "newIdent";
public static final String NOT_FLOODFILL = "disabledFloodfill";
public static final String OOM = "oom";
public static final String REKEYED = "rekeyed";
public static final String RESEED = "reseed";