Commit f5269931 authored by Grigorii Demidov's avatar Grigorii Demidov

daemon: increase udp timeouts when forwarding

parent fd54dd5a
...@@ -987,7 +987,8 @@ static void on_retransmit(uv_timer_t *req) ...@@ -987,7 +987,8 @@ static void on_retransmit(uv_timer_t *req)
struct qr_task *task = session_tasklist_get_first(session); struct qr_task *task = session_tasklist_get_first(session);
if (retransmit(task) == NULL) { if (retransmit(task) == NULL) {
/* Not possible to spawn request, start timeout timer with remaining deadline. */ /* Not possible to spawn request, start timeout timer with remaining deadline. */
uint64_t timeout = KR_CONN_RTT_MAX - task->pending_count * KR_CONN_RETRY; uint64_t timeout = task->ctx->req.options.FORWARD ? KR_NS_FWD_TIMEOUT / 2 :
KR_CONN_RTT_MAX - task->pending_count * KR_CONN_RETRY;
uv_timer_start(req, on_udp_timeout, timeout, 0); uv_timer_start(req, on_udp_timeout, timeout, 0);
} else { } else {
uv_timer_start(req, on_retransmit, KR_CONN_RETRY, 0); uv_timer_start(req, on_retransmit, KR_CONN_RETRY, 0);
......
...@@ -32,7 +32,8 @@ struct kr_query; ...@@ -32,7 +32,8 @@ struct kr_query;
*/ */
enum kr_ns_score { enum kr_ns_score {
KR_NS_MAX_SCORE = 20 * KR_CONN_RTT_MAX, /* max possible value */ KR_NS_MAX_SCORE = 20 * KR_CONN_RTT_MAX, /* max possible value */
KR_NS_FWD_TIMEOUT = 10000, /* timeout for upstream recursor */ KR_NS_FWD_TIMEOUT = (95 * 10000) / 100, /* timeout for upstream recursor,
* 95 percents from max resolution time */
KR_NS_TIMEOUT = (95 * KR_CONN_RTT_MAX) / 100, /* timeout for upstream auth */ KR_NS_TIMEOUT = (95 * KR_CONN_RTT_MAX) / 100, /* timeout for upstream auth */
KR_NS_LONG = (3 * KR_NS_TIMEOUT) / 4, KR_NS_LONG = (3 * KR_NS_TIMEOUT) / 4,
KR_NS_UNKNOWN = KR_NS_TIMEOUT / 2, KR_NS_UNKNOWN = KR_NS_TIMEOUT / 2,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment