From: Philip Withnall Date: Fri, 8 Aug 2014 08:54:23 +0000 (+0100) Subject: pseudotcp: Split out some state checks X-Git-Tag: 0.1.8~78 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b0f0e3eab87ca594557c64f3c29775f5bc3c2524;p=platform%2Fupstream%2Flibnice.git pseudotcp: Split out some state checks This clarifies the code a little, and does not introduce functional changes. --- diff --git a/agent/pseudotcp.c b/agent/pseudotcp.c index 1830c37..e8fc36a 100644 --- a/agent/pseudotcp.c +++ b/agent/pseudotcp.c @@ -1227,6 +1227,7 @@ process(PseudoTcpSocket *self, Segment *seg) gsize snd_buffered; gsize available_space; guint32 kIdealRefillSize; + gboolean is_valuable_ack, is_duplicate_ack; /* If this is the wrong conversation, send a reset!?! (with the correct conversation?) */ @@ -1288,8 +1289,11 @@ process(PseudoTcpSocket *self, Segment *seg) } // Check if this is a valuable ack - if (LARGER(seg->ack, priv->snd_una) && - SMALLER_OR_EQUAL(seg->ack, priv->snd_nxt)) { + is_valuable_ack = (LARGER(seg->ack, priv->snd_una) && + SMALLER_OR_EQUAL(seg->ack, priv->snd_nxt)); + is_duplicate_ack = (seg->ack == priv->snd_una); + + if (is_valuable_ack) { guint32 nAcked; guint32 nFree; @@ -1369,7 +1373,7 @@ process(PseudoTcpSocket *self, Segment *seg) 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 closed window become open? */ priv->snd_wnd = seg->wnd << priv->swnd_scale;