2005-09-30 jrandom

* Killed three more streaming lib bugs, one of which caused excess packets
      to be transmitted (dupacking dupacks), one that was the root of many of
      the old hung streams (shrinking highest received), and another that was
      releasing data too soon.
This commit is contained in:
jrandom
2005-09-30 23:12:57 +00:00
committed by zzz
parent 934a269753
commit 9dfa87ba47
6 changed files with 39 additions and 19 deletions

View File

@ -311,16 +311,20 @@ public class Connection {
} }
List ackPackets(long ackThrough, long nacks[]) { List ackPackets(long ackThrough, long nacks[]) {
if (nacks == null) { if (ackThrough < _highestAckedThrough) {
_highestAckedThrough = ackThrough; // dupack which won't tell us anything
} else { } else {
long lowest = -1; if (nacks == null) {
for (int i = 0; i < nacks.length; i++) { _highestAckedThrough = ackThrough;
if ( (lowest < 0) || (nacks[i] < lowest) ) } else {
lowest = nacks[i]; long lowest = -1;
for (int i = 0; i < nacks.length; i++) {
if ( (lowest < 0) || (nacks[i] < lowest) )
lowest = nacks[i];
}
if (lowest - 1 > _highestAckedThrough)
_highestAckedThrough = lowest - 1;
} }
if (lowest - 1 > _highestAckedThrough)
_highestAckedThrough = lowest - 1;
} }
List acked = null; List acked = null;

View File

@ -100,10 +100,12 @@ public class ConnectionPacketHandler {
(packet.getReceiveStreamId() <= 0) ) ) (packet.getReceiveStreamId() <= 0) ) )
allowAck = false; allowAck = false;
if (allowAck) if (allowAck) {
isNew = con.getInputStream().messageReceived(packet.getSequenceNum(), packet.getPayload()); isNew = con.getInputStream().messageReceived(packet.getSequenceNum(), packet.getPayload());
else } else {
isNew = con.getInputStream().messageReceived(con.getInputStream().getHighestReadyBockId(), null); con.getInputStream().notifyActivity();
isNew = false;
}
if ( (packet.getSequenceNum() == 0) && (packet.getPayloadSize() > 0) ) { if ( (packet.getSequenceNum() == 0) && (packet.getPayloadSize() > 0) ) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
@ -166,10 +168,16 @@ public class ConnectionPacketHandler {
} }
con.eventOccurred(); con.eventOccurred();
if (fastAck) { if (fastAck) {
if (con.getLastSendTime() + 2000 < _context.clock().now()) { if (!isNew) {
if (_log.shouldLog(Log.DEBUG)) // if we're congested (fastAck) but this is also a new packet,
_log.debug("Fast ack for dup " + packet); // we've already scheduled an ack above, so there is no need to schedule
con.ackImmediately(); // a fast ack (we can wait a few ms)
} else {
if (con.getLastSendTime() + 2000 < _context.clock().now()) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Fast ack for dup " + packet);
con.ackImmediately();
}
} }
} }

View File

@ -193,6 +193,8 @@ public class MessageInputStream extends InputStream {
} }
} }
public void notifyActivity() { synchronized (_dataLock) { _dataLock.notifyAll(); } }
/** /**
* A new message has arrived - toss it on the appropriate queue (moving * A new message has arrived - toss it on the appropriate queue (moving
* previously pending messages to the ready queue if it fills the gap, etc). * previously pending messages to the ready queue if it fills the gap, etc).

View File

@ -222,7 +222,7 @@ public class Packet {
return (_payload == null ? 0 : _payload.getValid()); return (_payload == null ? 0 : _payload.getValid());
} }
public void releasePayload() { public void releasePayload() {
_payload = null; //_payload = null;
} }
public ByteArray acquirePayload() { public ByteArray acquirePayload() {
ByteArray old = _payload; ByteArray old = _payload;

View File

@ -1,4 +1,10 @@
$Id: history.txt,v 1.273 2005/09/30 12:51:32 ragnarok Exp $ $Id: history.txt,v 1.274 2005/09/30 15:29:19 jrandom Exp $
2005-09-30 jrandom
* Killed three more streaming lib bugs, one of which caused excess packets
to be transmitted (dupacking dupacks), one that was the root of many of
the old hung streams (shrinking highest received), and another that was
releasing data too soon.
2005-09-30 jrandom 2005-09-30 jrandom
* Only allow autodetection of our IP address if we haven't received an * Only allow autodetection of our IP address if we haven't received an

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
* *
*/ */
public class RouterVersion { public class RouterVersion {
public final static String ID = "$Revision: 1.251 $ $Date: 2005/09/30 02:17:57 $"; public final static String ID = "$Revision: 1.252 $ $Date: 2005/09/30 15:29:19 $";
public final static String VERSION = "0.6.1"; public final static String VERSION = "0.6.1";
public final static long BUILD = 2; public final static long BUILD = 3;
public static void main(String args[]) { public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID); System.out.println("Router ID: " + RouterVersion.ID);