X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=utcp.c;h=5427c3e3798ef2fa470c1f89942bde3bdb480912;hb=4dc6900e44115c18468ee27803dfbed8908754fd;hp=fceffbd0856b2a383b008bafb7f488f1ae3489fa;hpb=de87ec33f4c97689d670ea58c48bb0a74d235042;p=utcp diff --git a/utcp.c b/utcp.c index fceffbd..5427c3e 100644 --- a/utcp.c +++ b/utcp.c @@ -879,10 +879,7 @@ ssize_t utcp_recv(struct utcp *utcp, const void *data, size_t len) { // ackno should not roll back, and it should also not be bigger than what we ever could have sent // (= snd.una + c->sndbuf.used). - if(hdr.ctl & ACK && - ((seqdiff(hdr.ack, c->snd.una + c->sndbuf.used) > 0 && - seqdiff(hdr.ack, c->snd.nxt) > 0) // TODO: simplify this if - || seqdiff(hdr.ack, c->snd.una) < 0)) { + if(hdr.ctl & ACK && (seqdiff(hdr.ack, c->snd.last) > 0 || seqdiff(hdr.ack, c->snd.una) < 0)) { debug("Packet ack seqno out of range, %u <= %u < %u\n", c->snd.una, hdr.ack, c->snd.una + c->sndbuf.used); // Ignore unacceptable RST packets. if(hdr.ctl & RST) @@ -1167,7 +1164,6 @@ ssize_t utcp_recv(struct utcp *utcp, const void *data, size_t len) { // - or we got an ack, so we should maybe send a bit more data // -> sendatleastone = false -ack: ack(c, prevrcvnxt != c->rcv.nxt); return 0;