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);
|
Connection con = (sendId > 0 ? _manager.getConnectionByInboundId(sendId) : null);
|
||||||
if (con != null) {
|
if (con != null) {
|
||||||
receiveKnownCon(con, packet);
|
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
displayPacket(packet, "RECV", "wsize " + con.getOptions().getWindowSize() + " rto " + con.getOptions().getRTO());
|
displayPacket(packet, "RECV", "wsize " + con.getOptions().getWindowSize() + " rto " + con.getOptions().getRTO());
|
||||||
|
receiveKnownCon(con, packet);
|
||||||
} else {
|
} else {
|
||||||
receiveUnknownCon(packet, sendId, queueIfNoConn);
|
receiveUnknownCon(packet, sendId, queueIfNoConn);
|
||||||
displayPacket(packet, "UNKN", null);
|
displayPacket(packet, "UNKN", null);
|
||||||
|
@ -265,19 +265,24 @@ public class PcapWriter {
|
|||||||
long window = ConnectionOptions.INITIAL_WINDOW_SIZE;
|
long window = ConnectionOptions.INITIAL_WINDOW_SIZE;
|
||||||
long msgSize = ConnectionOptions.DEFAULT_MAX_MESSAGE_SIZE;
|
long msgSize = ConnectionOptions.DEFAULT_MAX_MESSAGE_SIZE;
|
||||||
if (con != null) {
|
if (con != null) {
|
||||||
|
// calculate the receive window, which doesn't have an exact streaming equivalent
|
||||||
if (isInbound) {
|
if (isInbound) {
|
||||||
|
// Inbound pkt: his rcv buffer ~= our outbound window
|
||||||
// try to represent what he thinks the window is, we don't really know
|
// 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
|
// 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 {
|
} else {
|
||||||
|
// Ourbound pkt: our rcv buffer ~= his outbound window
|
||||||
|
// TODO just use a recent high unackedIn count?
|
||||||
// following is from ConnectionPacketHandler
|
// following is from ConnectionPacketHandler
|
||||||
|
// this is not interesting, we have lots of buffers
|
||||||
long ready = con.getInputStream().getHighestReadyBockId();
|
long ready = con.getInputStream().getHighestReadyBockId();
|
||||||
int available = con.getOptions().getInboundBufferSize() - con.getInputStream().getTotalReadySize();
|
int available = con.getOptions().getInboundBufferSize() - con.getInputStream().getTotalReadySize();
|
||||||
int allowedBlocks = available/con.getOptions().getMaxMessageSize();
|
int allowedBlocks = available/con.getOptions().getMaxMessageSize();
|
||||||
window = (ready + allowedBlocks) - pkt.getSequenceNum();
|
window = (ready + allowedBlocks) - pkt.getSequenceNum();
|
||||||
}
|
}
|
||||||
if (window < 0)
|
if (window <= 1)
|
||||||
window = 0;
|
window = 2; // TCP min
|
||||||
msgSize = con.getOptions().getMaxMessageSize();
|
msgSize = con.getOptions().getMaxMessageSize();
|
||||||
}
|
}
|
||||||
// messages -> bytes
|
// messages -> bytes
|
||||||
|
Reference in New Issue
Block a user