1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

fixed crash in adnl

This commit is contained in:
ton 2020-02-29 09:07:12 +04:00
parent dd4ac0f440
commit 27aaa11524
2 changed files with 4 additions and 4 deletions

View file

@ -147,7 +147,7 @@ void AdnlPeerPairImpl::receive_packet_checked(AdnlPacket packet) {
return; return;
} }
if (packet.seqno() > 0) { if (packet.seqno() > 0) {
if (received_packet(static_cast<td::uint32>(packet.seqno()))) { if (received_packet(packet.seqno())) {
VLOG(ADNL_INFO) << this << ": dropping IN message: old seqno: " << packet.seqno() << " (current max " << in_seqno_ VLOG(ADNL_INFO) << this << ": dropping IN message: old seqno: " << packet.seqno() << " (current max " << in_seqno_
<< ")"; << ")";
return; return;
@ -165,7 +165,7 @@ void AdnlPeerPairImpl::receive_packet_checked(AdnlPacket packet) {
// delivering // delivering
if (packet.seqno() > 0) { if (packet.seqno() > 0) {
add_received_packet(static_cast<td::uint32>(packet.seqno())); add_received_packet(packet.seqno());
} }
if (packet.confirm_seqno() > ack_seqno_) { if (packet.confirm_seqno() > ack_seqno_) {

View file

@ -123,7 +123,7 @@ class AdnlPeerPairImpl : public AdnlPeerPair {
td::Result<td::actor::ActorId<AdnlNetworkConnection>> get_conn(); td::Result<td::actor::ActorId<AdnlNetworkConnection>> get_conn();
void create_channel(pubkeys::Ed25519 pub, td::uint32 date); void create_channel(pubkeys::Ed25519 pub, td::uint32 date);
bool received_packet(td::uint32 seqno) const { bool received_packet(td::uint64 seqno) const {
CHECK(seqno > 0); CHECK(seqno > 0);
if (seqno + 64 <= in_seqno_) { if (seqno + 64 <= in_seqno_) {
return true; return true;
@ -134,7 +134,7 @@ class AdnlPeerPairImpl : public AdnlPeerPair {
return recv_seqno_mask_ & (1ull << (in_seqno_ - seqno)); return recv_seqno_mask_ & (1ull << (in_seqno_ - seqno));
} }
void add_received_packet(td::uint32 seqno) { void add_received_packet(td::uint64 seqno) {
CHECK(!received_packet(seqno)); CHECK(!received_packet(seqno));
if (seqno <= in_seqno_) { if (seqno <= in_seqno_) {
recv_seqno_mask_ |= (1ull << (in_seqno_ - seqno)); recv_seqno_mask_ |= (1ull << (in_seqno_ - seqno));