X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=utcp.c;h=f2354b1b8d181fd103edcfff3b7b4c7bbf44b9ec;hb=d91fb4d8ac423f782ceb863b20e40095b891231b;hp=fc147c295208631454682640fd6e30384b29bf26;hpb=b0cd5e3cc7c991afbab53f64f7a57887f6c5d403;p=utcp diff --git a/utcp.c b/utcp.c index fc147c2..f2354b1 100644 --- a/utcp.c +++ b/utcp.c @@ -49,7 +49,7 @@ (r)->tv_sec = (a)->tv_sec - (b)->tv_sec;\ (r)->tv_usec = (a)->tv_usec - (b)->tv_usec;\ if((r)->tv_usec < 0)\ - (r)->tv_sec--, (r)->tv_usec += 1000000;\ + (r)->tv_sec--, (r)->tv_usec += USEC_PER_SEC;\ } while (0) #endif @@ -650,7 +650,7 @@ cleanup: * that are shifted to before the start of the receive buffer. * * There are three cases: - * - the SACK entry is ahead of ^, in that case just change the offset. + * - the SACK entry is after ^, in that case just change the offset. * - the SACK entry starts before and ends after ^, so we have to * change both its offset and size. * - the SACK entry is completely before ^, in that case delete it. @@ -706,6 +706,8 @@ static void handle_out_of_order(struct utcp_connection *c, uint32_t offset, cons memmove(&c->sacks[i + 1], &c->sacks[i], (NSACKS - i - 1) * sizeof c->sacks[i]); c->sacks[i].offset = offset; c->sacks[i].len = rxd; + } else { + debug("SACK entries full, dropping packet\n"); } break; } else { // merge @@ -1432,8 +1434,8 @@ struct utcp *utcp_init(utcp_accept_t accept, utcp_pre_accept_t pre_accept, utcp_ utcp->send = send; utcp->priv = priv; utcp->mtu = DEFAULT_MTU; - utcp->timeout = DEFAULT_USER_TIMEOUT; // s - utcp->rto = START_RTO; // us + utcp->timeout = DEFAULT_USER_TIMEOUT; // sec + utcp->rto = START_RTO; // usec return utcp; }