forked from I2P_Developers/i2p.i2p
Streaming: Kill accept() when session disconnects
This commit is contained in:
@ -54,15 +54,14 @@ class ConnectionHandler {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("setActive(" + active + ") called, previously " + _active, new Exception("I did it"));
|
||||
// if starting, clear any old poison
|
||||
// if stopping, the accept() loop will clear any pending sockets
|
||||
if (active && !_active)
|
||||
_synQueue.clear();
|
||||
boolean wasActive = _active;
|
||||
_active = active;
|
||||
if (wasActive && !active) {
|
||||
try {
|
||||
_synQueue.put(new PoisonPacket()); // so we break from the accept() - waits until space is available
|
||||
} catch (InterruptedException ie) {}
|
||||
// stopping, clear any pending sockets
|
||||
_synQueue.clear();
|
||||
_synQueue.offer(new PoisonPacket());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,8 @@ class MessageHandler implements I2PSessionMuxedListener {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("I2PSession disconnected");
|
||||
_manager.disconnectAllHard();
|
||||
// kill anybody waiting in accept()
|
||||
_manager.getConnectionHandler().setActive(false);
|
||||
|
||||
for (I2PSocketManager.DisconnectListener lsnr : _listeners) {
|
||||
lsnr.sessionDisconnected();
|
||||
@ -119,9 +121,7 @@ class MessageHandler implements I2PSessionMuxedListener {
|
||||
*/
|
||||
public void errorOccurred(I2PSession session, String message, Throwable error) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("error occurred: " + message + "- " + error.getMessage());
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("cause", error);
|
||||
_log.warn("error occurred: " + message + "- " + error.getMessage(), error);
|
||||
//_manager.disconnectAllHard();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user