forked from I2P_Developers/i2p.i2p
i2psnark: Don't mark torrent BAD on I2CP errors (ticket #2725)
Logging: - Log to wrapper log after log manager shutdown (ticket #2725) - sync methods Router: - Allow clients more time to get disconnect messages at shutdown (ticket #2725) - Don't delete router context at shutdown, to prevent a late creation of a new app context (ticket #2725) - Don't try to delete ping file on Android javadocs
This commit is contained in:
@ -188,6 +188,9 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
* You must call runRouter() after any constructor to start things up.
|
||||
*
|
||||
* Config file name is "router.config" unless router.configLocation set in system properties.
|
||||
*
|
||||
* See two-arg constructor for more information.
|
||||
*
|
||||
* @throws IllegalStateException since 0.9.19 if another router with this config is running
|
||||
*/
|
||||
public Router() { this(null, null); }
|
||||
@ -199,6 +202,8 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
*
|
||||
* Config file name is "router.config" unless router.configLocation set in envProps or system properties.
|
||||
*
|
||||
* See two-arg constructor for more information.
|
||||
*
|
||||
* @param envProps may be null
|
||||
* @throws IllegalStateException since 0.9.19 if another router with this config is running
|
||||
*/
|
||||
@ -209,6 +214,8 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
* RouterContext is created but not initialized.
|
||||
* You must call runRouter() after any constructor to start things up.
|
||||
*
|
||||
* See two-arg constructor for more information.
|
||||
*
|
||||
* @param configFilename may be null
|
||||
* @throws IllegalStateException since 0.9.19 if another router with this config is running
|
||||
*/
|
||||
@ -237,7 +244,7 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
* in this constructor.
|
||||
* If files in an existing config dir indicate that another router is already running
|
||||
* with this directory, the constructor will delay for several seconds to be sure,
|
||||
* and then call System.exit(-1).
|
||||
* and then throw an IllegalStateException.
|
||||
*
|
||||
* @param configFilename may be null
|
||||
* @param envProps may be null
|
||||
@ -1476,7 +1483,23 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
}
|
||||
|
||||
_context.removeShutdownTasks();
|
||||
|
||||
// All in-JVM clients should be gone by now,
|
||||
// unless they are stuck waiting for tunnels.
|
||||
// If we have any of those, or external clients,
|
||||
// we will wait below for the I2CP disconnect messages to get to them.
|
||||
boolean waitForClients = _killVMOnEnd && !_context.clientManager().listClients().isEmpty();
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Stopping ClientManager");
|
||||
try { _context.clientManager().shutdown(); } catch (Throwable t) { _log.error("Error shutting down the client manager", t); }
|
||||
if (waitForClients) {
|
||||
// Give time for the disconnect messages to get to them
|
||||
// so they can shut down correctly before the JVM goes away
|
||||
try { Thread.sleep(1500); } catch (InterruptedException ie) {}
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Done waiting for clients to disconnect");
|
||||
}
|
||||
|
||||
try { _context.namingService().shutdown(); } catch (Throwable t) { _log.error("Error shutting down the naming service", t); }
|
||||
try { _context.jobQueue().shutdown(); } catch (Throwable t) { _log.error("Error shutting down the job queue", t); }
|
||||
try { _context.tunnelManager().shutdown(); } catch (Throwable t) { _log.error("Error shutting down the tunnel manager", t); }
|
||||
@ -1541,9 +1564,16 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
killKeys();
|
||||
}
|
||||
|
||||
File f = getPingFile();
|
||||
f.delete();
|
||||
if (RouterContext.getContexts().isEmpty())
|
||||
if (!SystemVersion.isAndroid()) {
|
||||
File f = getPingFile();
|
||||
f.delete();
|
||||
}
|
||||
|
||||
// Only do this on Android. On desktop, rogue threads
|
||||
// may create a new I2PAppContext before the JVM stops
|
||||
// if we delete this one.
|
||||
//if (RouterContext.getContexts().isEmpty())
|
||||
if (SystemVersion.isAndroid())
|
||||
RouterContext.killGlobalContext();
|
||||
|
||||
// Since 0.8.8, for Android and the wrapper
|
||||
|
@ -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 = 12;
|
||||
public final static long BUILD = 13;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
Reference in New Issue
Block a user