Lines 1487-1492
size_t UTPSocket::selective_ack_bytes(uint base, c
Link Here
|
1487 |
return acked_bytes; |
1487 |
return acked_bytes; |
1488 |
} |
1488 |
} |
1489 |
|
1489 |
|
|
|
1490 |
enum { MAX_EACK = 128 }; |
1491 |
|
1490 |
void UTPSocket::selective_ack(uint base, const byte *mask, byte len) |
1492 |
void UTPSocket::selective_ack(uint base, const byte *mask, byte len) |
1491 |
{ |
1493 |
{ |
1492 |
if (cur_window_packets == 0) return; |
1494 |
if (cur_window_packets == 0) return; |
Lines 1499-1505
void UTPSocket::selective_ack(uint base, const byt
Link Here
|
1499 |
// resends is a stack of sequence numbers we need to resend. Since we |
1501 |
// resends is a stack of sequence numbers we need to resend. Since we |
1500 |
// iterate in reverse over the acked packets, at the end, the top packets |
1502 |
// iterate in reverse over the acked packets, at the end, the top packets |
1501 |
// are the ones we want to resend |
1503 |
// are the ones we want to resend |
1502 |
int resends[32]; |
1504 |
int resends[MAX_EACK]; |
1503 |
int nr = 0; |
1505 |
int nr = 0; |
1504 |
|
1506 |
|
1505 |
LOG_UTPV("0x%08x: Got EACK [%032b] base:%u", this, *(uint32*)mask, base); |
1507 |
LOG_UTPV("0x%08x: Got EACK [%032b] base:%u", this, *(uint32*)mask, base); |
Lines 1572-1577
void UTPSocket::selective_ack(uint base, const byt
Link Here
|
1572 |
if (((v - fast_resend_seq_nr) & ACK_NR_MASK) <= OUTGOING_BUFFER_MAX_SIZE && |
1574 |
if (((v - fast_resend_seq_nr) & ACK_NR_MASK) <= OUTGOING_BUFFER_MAX_SIZE && |
1573 |
count >= DUPLICATE_ACKS_BEFORE_RESEND && |
1575 |
count >= DUPLICATE_ACKS_BEFORE_RESEND && |
1574 |
duplicate_ack < DUPLICATE_ACKS_BEFORE_RESEND) { |
1576 |
duplicate_ack < DUPLICATE_ACKS_BEFORE_RESEND) { |
|
|
1577 |
// resends is a stack, and we're mostly interested in the top of it |
1578 |
// if we're full, just throw away the lower half |
1579 |
if (nr >= MAX_EACK - 2) { |
1580 |
memmove(resends, &resends[MAX_EACK/2], MAX_EACK/2 * sizeof(resends[0])); |
1581 |
nr -= MAX_EACK / 2; |
1582 |
} |
1575 |
resends[nr++] = v; |
1583 |
resends[nr++] = v; |
1576 |
LOG_UTPV("0x%08x: no ack for %u", this, v); |
1584 |
LOG_UTPV("0x%08x: no ack for %u", this, v); |
1577 |
} else { |
1585 |
} else { |
Lines 1580-1592
void UTPSocket::selective_ack(uint base, const byt
Link Here
|
1580 |
} |
1588 |
} |
1581 |
} while (--bits >= -1); |
1589 |
} while (--bits >= -1); |
1582 |
|
1590 |
|
1583 |
if (((base - 1 - fast_resend_seq_nr) & ACK_NR_MASK) < 256 && |
1591 |
if (((base - 1 - fast_resend_seq_nr) & ACK_NR_MASK) <= OUTGOING_BUFFER_MAX_SIZE && |
1584 |
count >= DUPLICATE_ACKS_BEFORE_RESEND && |
1592 |
count >= DUPLICATE_ACKS_BEFORE_RESEND) { |
1585 |
duplicate_ack < DUPLICATE_ACKS_BEFORE_RESEND) { |
|
|
1586 |
// if we get enough duplicate acks to start |
1593 |
// if we get enough duplicate acks to start |
1587 |
// resending, the first packet we should resend |
1594 |
// resending, the first packet we should resend |
1588 |
// is base-1 |
1595 |
// is base-1 |
1589 |
resends[nr++] = base - 1; |
1596 |
resends[nr++] = (base - 1) & ACK_NR_MASK; |
1590 |
} else { |
1597 |
} else { |
1591 |
LOG_UTPV("0x%08x: not resending %u count:%d dup_ack:%u fast_resend_seq_nr:%u", |
1598 |
LOG_UTPV("0x%08x: not resending %u count:%d dup_ack:%u fast_resend_seq_nr:%u", |
1592 |
this, base - 1, count, duplicate_ack, fast_resend_seq_nr); |
1599 |
this, base - 1, count, duplicate_ack, fast_resend_seq_nr); |