transfer time temporality buffer

This commit is contained in:
Green Sky 2024-07-07 15:27:30 +02:00
parent 269daaa764
commit fab3d42ee9
No known key found for this signature in database
2 changed files with 7 additions and 1 deletions

View File

@ -212,6 +212,7 @@ NGCFT1::NGCFT1(
}
float NGCFT1::iterate(float time_delta) {
_time_since_activity += time_delta;
bool transfer_in_progress {false};
for (auto& [group_number, group] : groups) {
for (auto& [peer_number, peer] : group.peers) {
@ -238,9 +239,13 @@ float NGCFT1::iterate(float time_delta) {
}
if (transfer_in_progress) {
_time_since_activity = 0.f;
// ~15ms for up to 1mb/s
// ~5ms for up to 4mb/s
return 0.005f; // 5ms
} else if (_time_since_activity < 0.5f) {
// bc of temporality
return 0.025f;
} else {
return 1.f; // once a sec might be too little
}

View File

@ -135,12 +135,13 @@ class NGCFT1 : public ToxEventI, public NGCEXTEventI, public NGCFT1EventProvider
std::default_random_engine _rng{std::random_device{}()};
float _time_since_activity {10.f};
// TODO: config
size_t acks_per_packet {3u}; // 3
float init_retry_timeout_after {4.f};
float sending_give_up_after {15.f}; // 30sec (per active transfer)
struct Group {
struct Peer {
uint32_t max_packet_data_size {500-4};