Commit 78c1d32d authored by Marek Vavruša's avatar Marek Vavruša Committed by Grigorii Demidov

daemon/worker: allow large responses for outbound over TCP

This was previously fixed in e25358d4,
but broken in the rewrite. The answer buffer size must be a maximum size,
otherwise payloads larger than configured UDP buffer size can't be
transmitted over TCP.
parent 0bb9723d
Pipeline #34848 passed with stages
in 7 minutes and 52 seconds
......@@ -2154,6 +2154,16 @@ int worker_process_tcp(struct worker_ctx *worker, uv_stream_t *handle,
/* FIXME: on high load over one connection, it's likely
* that we will get multiple matches sooner or later (!) */
if (task) {
/* Make sure we can process maximum packet sizes over TCP for outbound queries.
* Previous packet is allocated with mempool, so there's no need to free it manually. */
if (task->pktbuf->max_size < KNOT_WIRE_MAX_PKTSIZE) {
knot_mm_t *pool = &task->pktbuf->mm;
pkt_buf = knot_pkt_new(NULL, KNOT_WIRE_MAX_PKTSIZE, pool);
if (!pkt_buf) {
return kr_error(ENOMEM);
task->pktbuf = pkt_buf;
assert(task->leading == false);
} else {
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