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

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

SSU2: Fix overhead calculation for followon fragments

so as not to exceed MTU
parent 67082463
No related branches found
No related tags found
No related merge requests found
......@@ -457,6 +457,8 @@ class OutboundMessageFragments {
if (_log.shouldDebug())
_log.debug("Building packet for " + next + " to " + peer);
int curTotalDataSize = state.fragmentSize(next.num);
if (next.num > 0 && peer.getVersion() > 1)
curTotalDataSize += SSU2Util.DATA_FOLLOWON_EXTRA_SIZE;
// now stuff in more fragments if they fit
if (i +1 < toSend.size()) {
int maxAvail;
......@@ -469,6 +471,8 @@ class OutboundMessageFragments {
for (int j = i + 1; j < toSend.size(); j++) {
next = toSend.get(j);
int nextDataSize = next.state.fragmentSize(next.num);
if (next.num > 0 && peer.getVersion() > 1)
nextDataSize += SSU2Util.DATA_FOLLOWON_EXTRA_SIZE;
//if (PacketBuilder.canFitAnotherFragment(peer, sendNext.size(), curTotalDataSize, nextDataSize)) {
//if (_builder.canFitAnotherFragment(peer, sendNext.size(), curTotalDataSize, nextDataSize)) {
if (nextDataSize <= maxAvail) {
......
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