forked from I2P_Developers/i2p.i2p
I2PTunnel: Call destroySocketManager() when replacing
a client socket manager configured with i2cp.newDestOnResume, or a shared client. This prevents lots of orphaned StreamingTimer threads. There are still cases where these threads may stick around, when a tunnel is stopped but not restarted. We don't know in some cases when a tunnel could be restarted and when it can't. destroySocketManager() should always be called when discarding a SocketManager but i2ptunnel doesn't do that now. More to do, but this fixes the most common case of leaked threads. Related tickets: ##642 #961
This commit is contained in:
@@ -263,6 +263,8 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
getTunnel().removeSession(sess);
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn(getTunnel().getClientOptions().getProperty("inbound.nickname") + ": Built a new destination on resume");
|
||||
// make sure the old one is closed
|
||||
sockMgr.destroySocketManager();
|
||||
newManager = true;
|
||||
} // else the old socket manager will reconnect the old session if necessary
|
||||
}
|
||||
@@ -320,6 +322,8 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(tunnel.getClientOptions().getProperty("inbound.nickname") + ": Building a new socket manager since the old one closed [s=" + s + "]");
|
||||
tunnel.removeSession(s);
|
||||
// make sure the old one is closed
|
||||
socketManager.destroySocketManager();
|
||||
// We could be here a LONG time, holding the lock
|
||||
socketManager = buildSocketManager(tunnel, pkf);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user