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,6 +311,9 @@ public class Connection {
}
List ackPackets(long ackThrough, long nacks[]) {
if (ackThrough < _highestAckedThrough) {
// dupack which won't tell us anything
} else {
if (nacks == null) {
_highestAckedThrough = ackThrough;
} else {
@ -322,6 +325,7 @@ public class Connection {
if (lowest - 1 > _highestAckedThrough)
_highestAckedThrough = lowest - 1;
}
}
List acked = null;
synchronized (_outboundPackets) {

View File

@ -100,10 +100,12 @@ public class ConnectionPacketHandler {
(packet.getReceiveStreamId() <= 0) ) )
allowAck = false;
if (allowAck)
if (allowAck) {
isNew = con.getInputStream().messageReceived(packet.getSequenceNum(), packet.getPayload());
else
isNew = con.getInputStream().messageReceived(con.getInputStream().getHighestReadyBockId(), null);
} else {
con.getInputStream().notifyActivity();
isNew = false;
}
if ( (packet.getSequenceNum() == 0) && (packet.getPayloadSize() > 0) ) {
if (_log.shouldLog(Log.DEBUG))
@ -166,12 +168,18 @@ public class ConnectionPacketHandler {
}
con.eventOccurred();
if (fastAck) {
if (!isNew) {
// if we're congested (fastAck) but this is also a new packet,
// we've already scheduled an ack above, so there is no need to schedule
// 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();
}
}
}
if (ackOnly || !isNew) {
// non-ack message payloads are queued in the MessageInputStream

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
* 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());
}
public void releasePayload() {
_payload = null;
//_payload = null;
}
public ByteArray acquirePayload() {
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
* 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 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 long BUILD = 2;
public final static long BUILD = 3;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);