Skip to content

Commit

Permalink
Merge branch 'fix-retransmitted-pkts'
Browse files Browse the repository at this point in the history
  • Loading branch information
kyechou committed Oct 31, 2022
2 parents a993978 + 6d029fc commit 1e5f2d4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/emulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ void Emulation::listen_packets() {
while (p != pkts.end()) {
size_t hash_value = hasher(&*p);
if (recv_pkts_hash.count(hash_value) > 0) {
// Found a retransmitted packet, skip the remaining packets
pkts.erase(p, pkts.end());
break;
pkts.erase(p++);
} else {
recv_pkts_hash.insert(hash_value);
p++;
}
recv_pkts_hash.insert(hash_value);
p++;
}

recv_pkts.splice(recv_pkts.end(), pkts);
Expand Down Expand Up @@ -223,7 +222,6 @@ std::list<Packet> Emulation::send_pkt(const Packet &pkt) {
// Move and reset the received packets
std::list<Packet> pkts(std::move(recv_pkts));
recv_pkts.clear();
recv_pkts_hash.clear();
lck.unlock();

Net::get().reassemble_segments(pkts);
Expand Down

0 comments on commit 1e5f2d4

Please sign in to comment.