diff --git a/apps/streaming/java/src/net/i2p/client/streaming/impl/Connection.java b/apps/streaming/java/src/net/i2p/client/streaming/impl/Connection.java index 151ce2399a..86c3c96c72 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/impl/Connection.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/impl/Connection.java @@ -402,28 +402,27 @@ class Connection { windowSize = _options.getWindowSize(); remaining = windowSize - _outboundPackets.size() ; _outboundPackets.notifyAll(); - } - if (_isChoking) { - packet.setOptionalDelay(Packet.SEND_DELAY_CHOKE); - packet.setFlag(Packet.FLAG_DELAY_REQUESTED); - } else if (packet.isFlagSet(Packet.FLAG_CLOSE) || - _unchokesToSend.decrementAndGet() > 0 || - // the other end has no idea what our window size is, so - // help him out by requesting acks below the 1/3 point, - // if remaining < 3, and every 8 minimum. - (remaining < 3) || - (remaining < (windowSize + 2) / 3) /* || - (packet.getSequenceNum() % 8 == 0) */ ) { - packet.setOptionalDelay(0); - packet.setFlag(Packet.FLAG_DELAY_REQUESTED); - //if (_log.shouldLog(Log.DEBUG)) - // _log.debug("Requesting no ack delay for packet " + packet); - } else { - // This is somewhat of a waste of time, unless the RTT < 4000, - // since the other end limits it to getSendAckDelay() - // which is always 2000, but it's good for diagnostics to see what the other end thinks - // the RTT is. + if (_isChoking) { + packet.setOptionalDelay(Packet.SEND_DELAY_CHOKE); + packet.setFlag(Packet.FLAG_DELAY_REQUESTED); + } else if (packet.isFlagSet(Packet.FLAG_CLOSE) || + _unchokesToSend.decrementAndGet() > 0 || + // the other end has no idea what our window size is, so + // help him out by requesting acks below the 1/3 point, + // if remaining < 3, and every 8 minimum. + (remaining < 3) || + (remaining < (windowSize + 2) / 3) /* || + (packet.getSequenceNum() % 8 == 0) */ ) { + packet.setOptionalDelay(0); + packet.setFlag(Packet.FLAG_DELAY_REQUESTED); + //if (_log.shouldLog(Log.DEBUG)) + // _log.debug("Requesting no ack delay for packet " + packet); + } else { + // This is somewhat of a waste of time, unless the RTT < 4000, + // since the other end limits it to getSendAckDelay() + // which is always 2000, but it's good for diagnostics to see what the other end thinks + // the RTT is. /** int delay = _options.getRTT() / 2; packet.setOptionalDelay(delay); @@ -432,20 +431,21 @@ class Connection { if (_log.shouldLog(Log.DEBUG)) _log.debug("Requesting ack delay of " + delay + "ms for packet " + packet); **/ - } + } - int timeout = _options.getRTO(); + int timeout = _options.getRTO(); - // RFC 6298 section 5.1 - if (_retransmitEvent.scheduleIfNotRunning(timeout)) { - if (_log.shouldLog(Log.DEBUG)) - _log.debug(Connection.this + " Resend in " + timeout + " for " + packet); - } else { - if (_log.shouldLog(Log.DEBUG)) - _log.debug(Connection.this + " timer was already running"); + // RFC 6298 section 5.1 + if (_retransmitEvent.scheduleIfNotRunning(timeout)) { + if (_log.shouldLog(Log.DEBUG)) + _log.debug(Connection.this + " Resend in " + timeout + " for " + packet); + } else { + if (_log.shouldLog(Log.DEBUG)) + _log.debug(Connection.this + " timer was already running"); + } + + packet.setTimeout(timeout); } - - packet.setTimeout(timeout); } // warning, getStatLog() can be null @@ -578,23 +578,23 @@ class Connection { } anyLeft = !_outboundPackets.isEmpty(); _outboundPackets.notifyAll(); - } - if ((acked != null) && (!acked.isEmpty()) ) { - _ackSinceCongestion.set(true); - _bwEstimator.addSample(acked.size()); - if (anyLeft) { - // RFC 6298 section 5.3 - int rto = _options.getRTO(); - _retransmitEvent.pushBackRTO(rto); - - if (_log.shouldLog(Log.DEBUG)) - _log.debug(Connection.this + " not all packets acked, pushing timer out " + rto); - } else { - // RFC 6298 section 5.2 - if (_log.shouldLog(Log.DEBUG)) - _log.debug(Connection.this + " all outstanding packets acked, cancelling timer"); + if ((acked != null) && (!acked.isEmpty()) ) { + _ackSinceCongestion.set(true); + _bwEstimator.addSample(acked.size()); + if (anyLeft) { + // RFC 6298 section 5.3 + int rto = _options.getRTO(); + _retransmitEvent.pushBackRTO(rto); + + if (_log.shouldLog(Log.DEBUG)) + _log.debug(Connection.this + " not all packets acked, pushing timer out " + rto); + } else { + // RFC 6298 section 5.2 + if (_log.shouldLog(Log.DEBUG)) + _log.debug(Connection.this + " all outstanding packets acked, cancelling timer"); - _retransmitEvent.cancel(); + _retransmitEvent.cancel(); + } } } return acked; diff --git a/history.txt b/history.txt index 8e3f221f83..82a3b85c57 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,11 @@ +2020-05-21 zzz + * Streaming: Fix timer race (ticket #2739) + +2020-05-20 zzz + * i2ptunnel: Disable gzip for streamr server + * i2ptunnel, SusiDNS: Replace onblur with CSP-safe js + * Tunnels: Reduce the IBGW and client OBGW batch time + 2020-05-19 zzz * Util: Speed up zero compression diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 9535f12e9f..f7d70ed0aa 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -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 = 23; + public final static long BUILD = 24; /** for example "-test" */ public final static String EXTRA = "-rc";