Skip to content

Commit

Permalink
Adapt test-adnl to rate limits
Browse files Browse the repository at this point in the history
  • Loading branch information
SpyCheese committed Sep 5, 2024
1 parent e32a74e commit 89e1cd9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/test-adnl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,19 @@ int main() {

auto f = td::Clocks::system();
scheduler.run_in_context([&] {
for (td::uint32 i = 1; i <= ton::adnl::Adnl::huge_packet_max_size(); i++) {
// Don't send too many packets
// Channels are disabled, so packet rate is limited
for (td::uint32 i : {1, 2, 3, 4, 100, 500, 900}) {
remaining++;
td::actor::send_closure(adnl, &ton::adnl::Adnl::send_message, src, dst, send_packet(i));
}
for (td::uint32 i = 1024; i <= ton::adnl::Adnl::huge_packet_max_size() /* 1024 * 8 */; i += 1024) {
remaining++;
td::actor::send_closure(adnl, &ton::adnl::Adnl::send_message, src, dst, send_packet(i));
}
});

auto t = td::Timestamp::in(320.0);
auto t = td::Timestamp::in(60.0);
while (scheduler.run(1)) {
if (!remaining) {
break;
Expand All @@ -241,7 +247,7 @@ int main() {
}
}

LOG(ERROR) << "successfully tested delivering of packets of all sizes. Time=" << (td::Clocks::system() - f);
LOG(ERROR) << "successfully tested delivering of packets of various sizes. Time=" << (td::Clocks::system() - f);

scheduler.run_in_context([&] {
td::actor::send_closure(network_manager, &ton::adnl::TestLoopbackNetworkManager::add_node_id, src, true, true);
Expand Down

0 comments on commit 89e1cd9

Please sign in to comment.