forked from I2P_Developers/i2p.i2p
* Streaming: Pcap window size fixes
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user