Add event log for reachability change

This commit is contained in:
zzz
2015-02-06 00:47:41 +00:00
parent 60f86f342b
commit 761c883c1f
2 changed files with 7 additions and 6 deletions

View File

@@ -2827,6 +2827,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
if ( (status != old) && (status != CommSystemFacade.STATUS_UNKNOWN) ) { if ( (status != old) && (status != CommSystemFacade.STATUS_UNKNOWN) ) {
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("Old status: " + old + " New status: " + status + " from: ", new Exception("traceback")); _log.warn("Old status: " + old + " New status: " + status + " from: ", new Exception("traceback"));
if (old != CommSystemFacade.STATUS_UNKNOWN)
_context.router().eventLog().addEvent(EventLog.REACHABILITY, Integer.toString(status));
// Always rebuild when the status changes, even if our address hasn't changed, // Always rebuild when the status changes, even if our address hasn't changed,
// as rebuildExternalAddress() calls replaceAddress() which calls CSFI.notifyReplaceAddress() // as rebuildExternalAddress() calls replaceAddress() which calls CSFI.notifyReplaceAddress()
// which will start up NTCP inbound when we transition to OK. // which will start up NTCP inbound when we transition to OK.
@@ -2889,7 +2891,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
PeerState peer = iter.next(); PeerState peer = iter.next();
if ( (dontInclude != null) && (dontInclude.equals(peer.getRemoteHostId())) ) if ( (dontInclude != null) && (dontInclude.equals(peer.getRemoteHostId())) )
continue; continue;
// enforce IPv4 connection for BOB // enforce IPv4 connection if we are ALICE looking for a BOB
byte[] ip = peer.getRemoteIP(); byte[] ip = peer.getRemoteIP();
if (peerRole == BOB && ip.length != 4) if (peerRole == BOB && ip.length != 4)
continue; continue;
@@ -2952,12 +2954,10 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
_log.info("Running periodic test with bob = " + bob); _log.info("Running periodic test with bob = " + bob);
_testManager.runTest(bob.getRemoteIPAddress(), bob.getRemotePort(), bob.getCurrentCipherKey(), bob.getCurrentMACKey()); _testManager.runTest(bob.getRemoteIPAddress(), bob.getRemotePort(), bob.getCurrentCipherKey(), bob.getCurrentMACKey());
setLastTested(); setLastTested();
_forceRun = false; } else {
return; if (_log.shouldLog(Log.WARN))
_log.warn("Unable to run a periodic test, as there are no peers with the capacity required");
} }
if (_log.shouldLog(Log.WARN))
_log.warn("Unable to run a periodic test, as there are no peers with the capacity required");
_forceRun = false; _forceRun = false;
} }

View File

@@ -44,6 +44,7 @@ public class EventLog {
public static final String NEW_IDENT = "newIdent"; public static final String NEW_IDENT = "newIdent";
public static final String NOT_FLOODFILL = "disabledFloodfill"; public static final String NOT_FLOODFILL = "disabledFloodfill";
public static final String OOM = "oom"; public static final String OOM = "oom";
public static final String REACHABILITY = "reachability";
public static final String REKEYED = "rekeyed"; public static final String REKEYED = "rekeyed";
public static final String RESEED = "reseed"; public static final String RESEED = "reseed";
public static final String SOFT_RESTART = "softRestart"; public static final String SOFT_RESTART = "softRestart";