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

pseudotcp: Split out some state checks

This clarifies the code a little, and does not introduce functional
changes.
parent 5530a702
...@@ -1227,6 +1227,7 @@ process(PseudoTcpSocket *self, Segment *seg) ...@@ -1227,6 +1227,7 @@ process(PseudoTcpSocket *self, Segment *seg)
gsize snd_buffered; gsize snd_buffered;
gsize available_space; gsize available_space;
guint32 kIdealRefillSize; guint32 kIdealRefillSize;
gboolean is_valuable_ack, is_duplicate_ack;
/* If this is the wrong conversation, send a reset!?! /* If this is the wrong conversation, send a reset!?!
(with the correct conversation?) */ (with the correct conversation?) */
...@@ -1288,8 +1289,11 @@ process(PseudoTcpSocket *self, Segment *seg) ...@@ -1288,8 +1289,11 @@ process(PseudoTcpSocket *self, Segment *seg)
} }
// Check if this is a valuable ack // Check if this is a valuable ack
if (LARGER(seg->ack, priv->snd_una) && is_valuable_ack = (LARGER(seg->ack, priv->snd_una) &&
SMALLER_OR_EQUAL(seg->ack, priv->snd_nxt)) { SMALLER_OR_EQUAL(seg->ack, priv->snd_nxt));
is_duplicate_ack = (seg->ack == priv->snd_una);
if (is_valuable_ack) {
guint32 nAcked; guint32 nAcked;
guint32 nFree; guint32 nFree;
...@@ -1369,7 +1373,7 @@ process(PseudoTcpSocket *self, Segment *seg) ...@@ -1369,7 +1373,7 @@ process(PseudoTcpSocket *self, Segment *seg)
priv->cwnd += max(1LU, priv->mss * priv->mss / priv->cwnd); priv->cwnd += max(1LU, priv->mss * priv->mss / priv->cwnd);
} }
} }
} else if (seg->ack == priv->snd_una) { } else if (is_duplicate_ack) {
/* !?! Note, tcp says don't do this... but otherwise how does a /* !?! Note, tcp says don't do this... but otherwise how does a
closed window become open? */ closed window become open? */
priv->snd_wnd = seg->wnd << priv->swnd_scale; priv->snd_wnd = seg->wnd << priv->swnd_scale;
......
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