summaryrefslogtreecommitdiffstats
path: root/daemon/worker.c
diff options
context:
space:
mode:
authorOto Šťáva <oto.stava@nic.cz>2024-06-11 13:20:16 +0200
committerVladimír Čunát <vladimir.cunat@nic.cz>2024-07-22 17:57:47 +0200
commita872ebd4957e15196b95f3d7a6ce4771ebe7f352 (patch)
treed308427075aa920717da3571700268fa28238b97 /daemon/worker.c
parentdaemon/lua: bind `the_network` into lua (diff)
downloadknot-resolver-a872ebd4957e15196b95f3d7a6ce4771ebe7f352.tar.xz
knot-resolver-a872ebd4957e15196b95f3d7a6ce4771ebe7f352.zip
daemon: proper connection closures on queue overflow
Diffstat (limited to 'daemon/worker.c')
-rw-r--r--daemon/worker.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/daemon/worker.c b/daemon/worker.c
index f620904c..caf11e55 100644
--- a/daemon/worker.c
+++ b/daemon/worker.c
@@ -585,7 +585,7 @@ int qr_task_on_send(struct qr_task *task, struct session2 *s, int status)
"=> disconnected from '%s': %s\n",
peer_str, uv_strerror(status));
}
- worker_end_tcp(s);
+ session2_force_close(s);
return status;
}
@@ -1287,7 +1287,7 @@ static int qr_task_step(struct qr_task *task,
static int worker_submit(struct session2 *session, struct comm_info *comm, knot_pkt_t *pkt)
{
- if (!session || !pkt)
+ if (!session || !pkt || session->closing)
return kr_error(EINVAL);
const bool is_query = pkt->size > KNOT_WIRE_OFFSET_FLAGS1
@@ -1469,16 +1469,6 @@ static struct session2* worker_find_tcp_waiting(const struct sockaddr* addr)
return trie_find_tcp_session(the_worker->tcp_waiting, addr);
}
-int worker_end_tcp(struct session2 *session)
-{
- if (!session)
- return kr_error(EINVAL);
-
- session2_timer_stop(session);
- session2_force_close(session);
- return kr_ok();
-}
-
knot_pkt_t *worker_resolve_mk_pkt_dname(knot_dname_t *qname, uint16_t qtype, uint16_t qclass,
const struct kr_qflags *options)
{
@@ -2188,7 +2178,7 @@ exit:
wire_buf_movestart(wb);
mp_flush(the_worker->pkt_pool.ctx);
if (status < 0)
- worker_end_tcp(session);
+ session2_force_close(session);
return protolayer_break(ctx, status);
}