Streaming: Kill accept() when session disconnects

This commit is contained in:
zzz
2016-07-16 16:59:07 +00:00
parent 7f2bd164db
commit 37ebf04bb5
4 changed files with 13 additions and 9 deletions

View File

@ -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());
}
}

View File

@ -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();
}

View File

@ -1,5 +1,10 @@
2016-06-26 zzz
2016-07-16 zzz
* I2CP Client: Handle disconnect properly if received before first LS
* Streaming: Kill accept() when session disconnects
2016-06-25 zzz
* SSU peer testing: Add implementation (ticket #1752; proposal #126)
* Utils: Improve random seed initialization
2016-06-22 zzz
* SSU peer testing:

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 = 3;
public final static long BUILD = 4;
/** for example "-test" */
public final static String EXTRA = "";