Router: Fix soft restarts for 'massive' clock jumps (over +150s or -61s) and recover from standby/hibernate (ticket #1014).

I2P should now recover (better) from a system hibernate/standby and be able to reconnect to peers automatically.
This commit is contained in:
dg2-new
2015-09-27 21:15:51 +00:00
parent 39b810bd79
commit f46a902256
4 changed files with 9 additions and 5 deletions

View File

@@ -1443,8 +1443,10 @@ public class Router implements RouterClock.ClockShiftListener {
_eventLog.addEvent(EventLog.CLOCK_SHIFT, Long.toString(delta));
// update the routing key modifier
_context.routerKeyGenerator().generateDateBasedModData();
if (_context.commSystem().countActivePeers() <= 0)
return;
// Commented because this check makes no sense (#1014)
// .. and 'active' is relative to our broken time.
//if (_context.commSystem().countActivePeers() <= 0)
// return;
if (delta > 0)
_log.error("Restarting after large clock shift forward by " + DataHelper.formatDuration(delta));
else

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 10;
public final static long BUILD = 11;
/** for example "-test" */
public final static String EXTRA = "";

View File

@@ -30,9 +30,9 @@ public class Restarter implements Runnable {
log.logAlways(Log.WARN, "Stopping the tunnel manager");
try { _context.tunnelManager().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the tunnel manager", t); }
//try { _context.peerManager().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the peer manager", t); }
try { _context.peerManager().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the peer manager", t); }
//try { _context.netDb().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the networkDb", t); }
//try { _context.jobQueue().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the job queue", t); }
try { _context.jobQueue().restart(); } catch (Throwable t) { log.log(Log.CRIT, "Error restarting the job queue", t); }
log.logAlways(Log.WARN, "Router teardown complete, restarting the router...");
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}