From 270d9964452c36511c51f9da68923b86d165f01b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Vavru=C5=A1a?= Date: Thu, 19 Apr 2018 20:54:36 -0700 Subject: [PATCH] lib/nsrep: refactored copypasta --- lib/nsrep.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/nsrep.c b/lib/nsrep.c index 9a6824c4b..b11bddb45 100644 --- a/lib/nsrep.c +++ b/lib/nsrep.c @@ -147,17 +147,9 @@ static unsigned eval_addr_set(const pack_t *addr_set, struct kr_context *ctx, if (cur_addr_score >= rtt_cache_entry_score[i]) { continue; } - /* Shake down previous contenders */ - for (size_t j = KR_NSREP_MAXADDR - 1; j > i; --j) { - addr[j] = addr[j - 1]; - rtt_cache_entry_ptr[j] = rtt_cache_entry_ptr[ j - 1]; - rtt_cache_entry_score[j] = rtt_cache_entry_score[j - 1]; - } - addr[i] = it; - rtt_cache_entry_score[i] = cur_addr_score; - rtt_cache_entry_ptr[i] = cached; - break; - } else if (cur_addr_score < rtt_cache_entry_score[i] + favour) { + } + if (cur_addr_score >= KR_NS_TIMEOUT + || cur_addr_score < rtt_cache_entry_score[i] + favour) { /* Shake down previous contenders */ for (size_t j = KR_NSREP_MAXADDR - 1; j > i; --j) { addr[j] = addr[j - 1]; -- 2.47.2