From f344c9e0be56ba0307fbdef0039ff994a6429a8b Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 9 Feb 2009 12:55:35 +0000 Subject: [PATCH] plug connection leak --- .../src/net/i2p/client/streaming/Connection.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/streaming/java/src/net/i2p/client/streaming/Connection.java b/apps/streaming/java/src/net/i2p/client/streaming/Connection.java index ee93d20ee..a59e12610 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/Connection.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/Connection.java @@ -855,10 +855,12 @@ public class Connection { return; } // if one of us can't talk... - if ( (_closeSentOn > 0) || (_closeReceivedOn > 0) ) { - if (_log.shouldLog(Log.DEBUG)) _log.debug("Inactivity timeout reached, but we are closing"); - return; - } + // No - not true - data and acks are still going back and forth. + // Prevent zombie connections by keeping the inactivity timer. + //if ( (_closeSentOn > 0) || (_closeReceivedOn > 0) ) { + // if (_log.shouldLog(Log.DEBUG)) _log.debug("Inactivity timeout reached, but we are closing"); + // return; + //} if (_log.shouldLog(Log.DEBUG)) _log.debug("Inactivity timeout reached, with action=" + _options.getInactivityAction()); @@ -959,9 +961,9 @@ public class Connection { } if (getResetSent()) - buf.append(" reset sent"); + buf.append(" reset sent ").append(DataHelper.formatDuration(_context.clock().now() - getResetSentOn())).append(" ago"); if (getResetReceived()) - buf.append(" reset received"); + buf.append(" reset received ").append(DataHelper.formatDuration(_context.clock().now() - getDisconnectScheduledOn())).append(" ago"); if (getCloseSentOn() > 0) { buf.append(" close sent "); long timeSinceClose = _context.clock().now() - getCloseSentOn(); @@ -969,7 +971,7 @@ public class Connection { buf.append(" ago"); } if (getCloseReceivedOn() > 0) - buf.append(" close received"); + buf.append(" close received ").append(DataHelper.formatDuration(_context.clock().now() - getCloseReceivedOn())).append(" ago"); buf.append(" sent: ").append(1 + _lastSendId); if (_inputStream != null) buf.append(" rcvd: ").append(1 + _inputStream.getHighestBlockId() - missing);