transfer time temporality buffer
This commit is contained in:
parent
269daaa764
commit
fab3d42ee9
@ -212,6 +212,7 @@ NGCFT1::NGCFT1(
|
|||||||
}
|
}
|
||||||
|
|
||||||
float NGCFT1::iterate(float time_delta) {
|
float NGCFT1::iterate(float time_delta) {
|
||||||
|
_time_since_activity += time_delta;
|
||||||
bool transfer_in_progress {false};
|
bool transfer_in_progress {false};
|
||||||
for (auto& [group_number, group] : groups) {
|
for (auto& [group_number, group] : groups) {
|
||||||
for (auto& [peer_number, peer] : group.peers) {
|
for (auto& [peer_number, peer] : group.peers) {
|
||||||
@ -238,9 +239,13 @@ float NGCFT1::iterate(float time_delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (transfer_in_progress) {
|
if (transfer_in_progress) {
|
||||||
|
_time_since_activity = 0.f;
|
||||||
// ~15ms for up to 1mb/s
|
// ~15ms for up to 1mb/s
|
||||||
// ~5ms for up to 4mb/s
|
// ~5ms for up to 4mb/s
|
||||||
return 0.005f; // 5ms
|
return 0.005f; // 5ms
|
||||||
|
} else if (_time_since_activity < 0.5f) {
|
||||||
|
// bc of temporality
|
||||||
|
return 0.025f;
|
||||||
} else {
|
} else {
|
||||||
return 1.f; // once a sec might be too little
|
return 1.f; // once a sec might be too little
|
||||||
}
|
}
|
||||||
|
@ -135,12 +135,13 @@ class NGCFT1 : public ToxEventI, public NGCEXTEventI, public NGCFT1EventProvider
|
|||||||
|
|
||||||
std::default_random_engine _rng{std::random_device{}()};
|
std::default_random_engine _rng{std::random_device{}()};
|
||||||
|
|
||||||
|
float _time_since_activity {10.f};
|
||||||
|
|
||||||
// TODO: config
|
// TODO: config
|
||||||
size_t acks_per_packet {3u}; // 3
|
size_t acks_per_packet {3u}; // 3
|
||||||
float init_retry_timeout_after {4.f};
|
float init_retry_timeout_after {4.f};
|
||||||
float sending_give_up_after {15.f}; // 30sec (per active transfer)
|
float sending_give_up_after {15.f}; // 30sec (per active transfer)
|
||||||
|
|
||||||
|
|
||||||
struct Group {
|
struct Group {
|
||||||
struct Peer {
|
struct Peer {
|
||||||
uint32_t max_packet_data_size {500-4};
|
uint32_t max_packet_data_size {500-4};
|
||||||
|
Loading…
Reference in New Issue
Block a user