forked from I2P_Developers/i2p.i2p
* Streaming:
- Don't stop timers when session disconnects (tickets #644, #810) - Throw exception on attempt to use destroyed socket manager - Clear TCBShare cache when stopped - Javadocs
This commit is contained in:
@ -990,7 +990,7 @@ class Connection {
|
||||
// fall through
|
||||
default:
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Closing connection due to inactivity");
|
||||
_log.warn("Closing (inactivity) " + toString());
|
||||
if (_log.shouldLog(Log.DEBUG)) {
|
||||
StringBuilder buf = new StringBuilder(128);
|
||||
buf.append("last sent was: ").append(_context.clock().now() - _lastSendTime);
|
||||
|
@ -484,6 +484,7 @@ class ConnectionManager {
|
||||
* Something b0rked hard, so kill all of our connections without mercy.
|
||||
* Don't bother sending close packets.
|
||||
*
|
||||
* CAN continue to use the manager.
|
||||
*/
|
||||
public void disconnectAllHard() {
|
||||
for (Iterator<Connection> iter = _connectionByInboundId.values().iterator(); iter.hasNext(); ) {
|
||||
@ -491,6 +492,18 @@ class ConnectionManager {
|
||||
con.disconnect(false, false);
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Kill all connections and the timers.
|
||||
* Don't bother sending close packets.
|
||||
*
|
||||
* CANNOT continue to use the manager or restart.
|
||||
*
|
||||
* @since 0.9.7
|
||||
*/
|
||||
public void shutdown() {
|
||||
disconnectAllHard();
|
||||
_tcbShare.stop();
|
||||
_timer.stop();
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public class I2PSocketManagerFull implements I2PSocketManager {
|
||||
private String _name;
|
||||
private static int __managerId = 0;
|
||||
private final ConnectionManager _connectionManager;
|
||||
private volatile boolean _isDestroyed;
|
||||
|
||||
/**
|
||||
* How long to wait for the client app to accept() before sending back CLOSE?
|
||||
@ -200,6 +201,8 @@ public class I2PSocketManagerFull implements I2PSocketManager {
|
||||
}
|
||||
|
||||
private void verifySession() throws I2PException {
|
||||
if (_isDestroyed)
|
||||
throw new I2PException("destroyed");
|
||||
if (!_connectionManager.getSession().isClosed())
|
||||
return;
|
||||
_connectionManager.getSession().connect();
|
||||
@ -304,12 +307,14 @@ public class I2PSocketManagerFull implements I2PSocketManager {
|
||||
|
||||
/**
|
||||
* Destroy the socket manager, freeing all the associated resources. This
|
||||
* method will block untill all the managed sockets are closed.
|
||||
* method will block until all the managed sockets are closed.
|
||||
*
|
||||
* CANNOT be restarted.
|
||||
*/
|
||||
public void destroySocketManager() {
|
||||
_isDestroyed = true;
|
||||
_connectionManager.setAllowIncomingConnections(false);
|
||||
_connectionManager.disconnectAllHard();
|
||||
_connectionManager.shutdown();
|
||||
// should we destroy the _session too?
|
||||
// yes, since the old lib did (and SAM wants it to, and i dont know why not)
|
||||
if ( (_session != null) && (!_session.isClosed()) ) {
|
||||
|
@ -41,8 +41,12 @@ class TCBShare {
|
||||
_cleaner.schedule(CLEAN_TIME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cannot be restarted.
|
||||
*/
|
||||
public void stop() {
|
||||
_cleaner.cancel();
|
||||
_cache.clear();
|
||||
}
|
||||
|
||||
/** retrieve from cache */
|
||||
|
@ -87,6 +87,7 @@ public class SimpleTimer2 {
|
||||
/**
|
||||
* Stops the SimpleTimer.
|
||||
* Subsequent executions should not throw a RejectedExecutionException.
|
||||
* Cannot be restarted.
|
||||
*/
|
||||
public void stop() {
|
||||
_executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy());
|
||||
|
@ -1,3 +1,8 @@
|
||||
2013-07-04 zzz
|
||||
* Streaming:
|
||||
- Don't stop timers when session disconnects (tickets #644, #810)
|
||||
- Throw exception on attempt to use destroyed socket manager
|
||||
|
||||
2013-07-03 zzz
|
||||
* Console: Hide dead tunnel pools on /tunnels
|
||||
* Updater: Fix plugin update checker (ticket #897)
|
||||
|
@ -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 = 16;
|
||||
public final static long BUILD = 17;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "-rc";
|
||||
|
Reference in New Issue
Block a user