I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit a44e7520 authored by zzz's avatar zzz
Browse files

* Streaming: Pcap window size fixes

parent d0fa9f8f
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment