diff options
author | Vladimír Čunát <vladimir.cunat@nic.cz> | 2024-05-07 12:34:15 +0200 |
---|---|---|
committer | Vladimír Čunát <vladimir.cunat@nic.cz> | 2024-05-07 12:34:15 +0200 |
commit | 811a32e648747a685522b91641ee9e2b9ae5a1ce (patch) | |
tree | ae38050350875380bb953934769239c7cf03a59c /daemon/worker.c | |
parent | rrl: truncating answers when close to limit, dropping over limit (diff) | |
download | knot-resolver-811a32e648747a685522b91641ee9e2b9ae5a1ce.tar.xz knot-resolver-811a32e648747a685522b91641ee9e2b9ae5a1ce.zip |
daemon/rrl WIP: estimate CPU work done on behalf of clients
Diffstat (limited to 'daemon/worker.c')
-rw-r--r-- | daemon/worker.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/daemon/worker.c b/daemon/worker.c index 2d293ba9..0445d027 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -34,6 +34,7 @@ #include "lib/layer.h" #include "lib/layer/iterate.h" /* kr_response_classify */ #include "lib/utils.h" +#include "daemon/rrl/api.h" /* Magic defaults for the worker. */ @@ -362,6 +363,7 @@ static struct request_ctx *request_create(struct session2 *session, /* We need to store a copy of peer address. */ memcpy(&ctx->source.addr.ip, src_addr, kr_sockaddr_len(src_addr)); req->qsource.addr = &ctx->source.addr.ip; + kr_rrl_sample_addr(&ctx->source.addr); if (!comm_addr) comm_addr = src_addr; @@ -1214,6 +1216,9 @@ static int tcp_task_step(struct qr_task *task, static int qr_task_step(struct qr_task *task, const struct sockaddr *packet_source, knot_pkt_t *packet) { + if (task && task->ctx->source.session) + kr_rrl_sample_addr(&task->ctx->source.addr); + /* No more steps after we're finished. */ if (!task || task->finished) { return kr_error(ESTALE); |