mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Adapt test-adnl to rate limits
This commit is contained in:
parent
e32a74e9c5
commit
89e1cd9738
1 changed files with 9 additions and 3 deletions
|
@ -225,13 +225,19 @@ int main() {
|
||||||
|
|
||||||
auto f = td::Clocks::system();
|
auto f = td::Clocks::system();
|
||||||
scheduler.run_in_context([&] {
|
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++;
|
remaining++;
|
||||||
td::actor::send_closure(adnl, &ton::adnl::Adnl::send_message, src, dst, send_packet(i));
|
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)) {
|
while (scheduler.run(1)) {
|
||||||
if (!remaining) {
|
if (!remaining) {
|
||||||
break;
|
break;
|
||||||
|
@ -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([&] {
|
scheduler.run_in_context([&] {
|
||||||
td::actor::send_closure(network_manager, &ton::adnl::TestLoopbackNetworkManager::add_node_id, src, true, true);
|
td::actor::send_closure(network_manager, &ton::adnl::TestLoopbackNetworkManager::add_node_id, src, true, true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue