Skip to content

Commit

Permalink
fixed crash in adnl
Browse files Browse the repository at this point in the history
  • Loading branch information
ton committed Feb 29, 2020
1 parent dd4ac0f commit 27aaa11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions adnl/adnl-peer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void AdnlPeerPairImpl::receive_packet_checked(AdnlPacket packet) {
return;
}
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_
<< ")";
return;
Expand All @@ -165,7 +165,7 @@ void AdnlPeerPairImpl::receive_packet_checked(AdnlPacket packet) {
// delivering

if (packet.seqno() > 0) {
add_received_packet(static_cast<td::uint32>(packet.seqno()));
add_received_packet(packet.seqno());
}

if (packet.confirm_seqno() > ack_seqno_) {
Expand Down
4 changes: 2 additions & 2 deletions adnl/adnl-peer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class AdnlPeerPairImpl : public AdnlPeerPair {
td::Result<td::actor::ActorId<AdnlNetworkConnection>> get_conn();
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);
if (seqno + 64 <= in_seqno_) {
return true;
Expand All @@ -134,7 +134,7 @@ class AdnlPeerPairImpl : public AdnlPeerPair {
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));
if (seqno <= in_seqno_) {
recv_seqno_mask_ |= (1ull << (in_seqno_ - seqno));
Expand Down

0 comments on commit 27aaa11

Please sign in to comment.