Dynamic roundtime detection. (#244)

When consensus is unreliable detect roundtime based on roundtime reported by peers.
This commit is contained in:
Ravin Perera
2021-02-16 13:34:29 +05:30
committed by GitHub
parent 4c4e109233
commit 9f4499653a
19 changed files with 430 additions and 241 deletions

View File

@@ -37,7 +37,6 @@ namespace hpfs
this->name = name;
this->fs_mount = fs_mount;
REQUEST_RESUBMIT_TIMEOUT = hpfs::get_request_resubmit_timeout();
hpfs_sync_thread = std::thread(&hpfs_sync::hpfs_syncer_loop, this);
init_success = true;
return 0;
@@ -287,13 +286,16 @@ namespace hpfs
candidate_hpfs_responses.clear();
// No. of milliseconds to wait before resubmitting a request.
const uint16_t request_resubmit_timeout = hpfs::get_request_resubmit_timeout();
// Check for long-awaited responses and re-request them.
for (auto &[hash, request] : submitted_requests)
{
if (should_stop_request_loop(current_target_hash))
return 0;
if (request.waiting_time < REQUEST_RESUBMIT_TIMEOUT)
if (request.waiting_time < request_resubmit_timeout)
{
// Increment wait time.
request.waiting_time += REQUEST_LOOP_WAIT;