mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
integrating the existing state of TON Storage / TON Payments / CPS Fift development branches
This commit is contained in:
parent
040df63c98
commit
4e2624459b
153 changed files with 10760 additions and 1695 deletions
29
rldp2/Ack.cpp
Normal file
29
rldp2/Ack.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include "Ack.h"
|
||||
|
||||
namespace ton {
|
||||
namespace rldp2 {
|
||||
|
||||
bool Ack::on_got_packet(td::uint32 seqno) {
|
||||
if (seqno > max_seqno) {
|
||||
td::uint32 diff = seqno - max_seqno;
|
||||
if (diff >= 32) {
|
||||
received_mask = 0;
|
||||
} else {
|
||||
received_mask <<= diff;
|
||||
}
|
||||
max_seqno = seqno;
|
||||
}
|
||||
td::uint32 offset = max_seqno - seqno;
|
||||
if (offset < 32) {
|
||||
td::uint32 mask = 1 << offset;
|
||||
if ((received_mask & mask) == 0) {
|
||||
received_count++;
|
||||
received_mask |= mask;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
} // namespace rldp2
|
||||
} // namespace ton
|
Loading…
Add table
Add a link
Reference in a new issue