Skip to content
Snippets Groups Projects
Commit 1a568228 authored by Marek Vavruša's avatar Marek Vavruša
Browse files

daemon/worker: retransmit based on current score

if the score is known (and not glued), the retry
rate is <avg(rtt), 250ms>

if the NS score is unknown or worse than 250ms,
it is always retried at this rate

all other servers in the list use default rate
parent 5013e18b
No related branches found
No related tags found
No related merge requests found
......@@ -745,9 +745,21 @@ static int qr_task_step(struct qr_task *task, const struct sockaddr *packet_sour
if (subreq_enqueue(task)) {
return kr_ok(); /* Will be notified when outgoing query finishes. */
}
/* Check current query NSLIST */
struct kr_query *qry = array_tail(task->req.rplan.pending);
/* Start transmitting */
if (retransmit(task)) {
ret = timer_start(task, on_retransmit, KR_CONN_RETRY, 0);
assert(qry != NULL);
/* Retransmit at default interval, or more frequently if the mean
* RTT of the server is better. If the server is glued, use default rate. */
size_t timeout = qry->ns.score;
if (timeout > KR_NS_GLUED) {
/* We don't have information about variance in RTT, expect +10ms */
timeout = MIN(qry->ns.score + 10, KR_CONN_RETRY);
} else {
timeout = KR_CONN_RETRY;
}
ret = timer_start(task, on_retransmit, timeout, 0);
} else {
return qr_task_step(task, NULL, NULL);
}
......
......@@ -51,7 +51,7 @@ static inline int __attribute__((__cold__)) kr_error(int x) {
* @cond internal
*/
#define KR_CONN_RTT_MAX 3000 /* Timeout for network activity */
#define KR_CONN_RETRY 300 /* Retry interval for network activity */
#define KR_CONN_RETRY 250 /* Retry interval for network activity */
#define KR_ITER_LIMIT 50 /* Built-in iterator limit */
#define KR_CNAME_CHAIN_LIMIT 40 /* Built-in maximum CNAME chain length */
#define KR_TIMEOUT_LIMIT 4 /* Maximum number of retries after timeout. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment