X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=utcp.c;h=c21d6ab664b0146030c44d60e6feb730e924f0d8;hb=7034cc75e0324210e96b3da5ac09c979b73173b7;hp=fceffbd0856b2a383b008bafb7f488f1ae3489fa;hpb=de87ec33f4c97689d670ea58c48bb0a74d235042;p=utcp diff --git a/utcp.c b/utcp.c index fceffbd..c21d6ab 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; @@ -1325,6 +1321,7 @@ struct timeval utcp_timeout(struct utcp *utcp) { if(!c) continue; + // delete connections that have been utcp_close()d. if(c->state == CLOSED) { if(c->reapable) { debug("Reaping %p\n", c); @@ -1343,6 +1340,7 @@ struct timeval utcp_timeout(struct utcp *utcp) { } if(timerisset(&c->rtrx_timeout) && timercmp(&c->rtrx_timeout, &now, <)) { + debug("retransmit()\n"); retransmit(c); }