Commit 220bb5ca authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête

pseudotcp: Fix partial acknowledgement of segments

If an incoming ACK acknowledges part of a pending SSegment, correctly
increment the base offset of that SSegment before attempting to transmit
it. Otherwise, the wrong data will be transmitted and the offset passed
to packet() will be incorrect.
parent 8184eba6
...@@ -1324,6 +1324,7 @@ process(PseudoTcpSocket *self, Segment *seg) ...@@ -1324,6 +1324,7 @@ process(PseudoTcpSocket *self, Segment *seg)
if (nFree < data->len) { if (nFree < data->len) {
data->len -= nFree; data->len -= nFree;
data->seq += nFree;
nFree = 0; nFree = 0;
} else { } else {
if (data->len > priv->largest) { if (data->len > priv->largest) {
...@@ -1547,7 +1548,13 @@ transmit(PseudoTcpSocket *self, SSegment *segment, guint32 now) ...@@ -1547,7 +1548,13 @@ transmit(PseudoTcpSocket *self, SSegment *segment, guint32 now)
while (TRUE) { while (TRUE) {
guint32 seq = segment->seq; guint32 seq = segment->seq;
guint8 flags = (segment->bCtrl ? FLAG_CTL : 0); guint8 flags = (segment->bCtrl ? FLAG_CTL : 0);
PseudoTcpWriteResult wres = packet(self, seq, flags, PseudoTcpWriteResult wres;
/* The packet must not have already been acknowledged. */
g_assert_cmpuint (segment->seq, >=, priv->snd_una);
/* Write out the packet. */
wres = packet(self, seq, flags,
segment->seq - priv->snd_una, nTransmit, now); segment->seq - priv->snd_una, nTransmit, now);
if (wres == WR_SUCCESS) if (wres == WR_SUCCESS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment