diff --git a/apps/streaming/java/src/net/i2p/client/streaming/PacketHandler.java b/apps/streaming/java/src/net/i2p/client/streaming/PacketHandler.java index 6cdf3dc81aec4cee8bc669015d6cec840e810d8f..ed10b6e2abdf3f60aeb80a1c0b041b717be2f1f2 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/PacketHandler.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/PacketHandler.java @@ -101,9 +101,9 @@ class PacketHandler { Connection con = (sendId > 0 ? _manager.getConnectionByInboundId(sendId) : null); if (con != null) { - receiveKnownCon(con, packet); if (_log.shouldLog(Log.INFO)) displayPacket(packet, "RECV", "wsize " + con.getOptions().getWindowSize() + " rto " + con.getOptions().getRTO()); + receiveKnownCon(con, packet); } else { receiveUnknownCon(packet, sendId, queueIfNoConn); displayPacket(packet, "UNKN", null); diff --git a/apps/streaming/java/src/net/i2p/client/streaming/PcapWriter.java b/apps/streaming/java/src/net/i2p/client/streaming/PcapWriter.java index 1eee76190f88920f0e3553f9b72168e25044315d..930ced57c84a92be43b6c03b15100fc42fa0954e 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/PcapWriter.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/PcapWriter.java @@ -265,19 +265,24 @@ public class PcapWriter { long window = ConnectionOptions.INITIAL_WINDOW_SIZE; long msgSize = ConnectionOptions.DEFAULT_MAX_MESSAGE_SIZE; if (con != null) { + // calculate the receive window, which doesn't have an exact streaming equivalent if (isInbound) { + // Inbound pkt: his rcv buffer ~= our outbound window // try to represent what he thinks the window is, we don't really know // this isn't really right, the lastsendid can get way ahead - window = acked + con.getOptions().getWindowSize() - con.getLastSendId(); + window = con.getLastSendId() + con.getOptions().getWindowSize() - acked; } else { + // Ourbound pkt: our rcv buffer ~= his outbound window + // TODO just use a recent high unackedIn count? // following is from ConnectionPacketHandler + // this is not interesting, we have lots of buffers long ready = con.getInputStream().getHighestReadyBockId(); int available = con.getOptions().getInboundBufferSize() - con.getInputStream().getTotalReadySize(); int allowedBlocks = available/con.getOptions().getMaxMessageSize(); window = (ready + allowedBlocks) - pkt.getSequenceNum(); } - if (window < 0) - window = 0; + if (window <= 1) + window = 2; // TCP min msgSize = con.getOptions().getMaxMessageSize(); } // messages -> bytes