summaryrefslogtreecommitdiffstats
path: root/daemon/io.c
diff options
context:
space:
mode:
authorOto Šťáva <oto.stava@nic.cz>2024-06-11 16:45:24 +0200
committerVladimír Čunát <vladimir.cunat@nic.cz>2024-07-22 17:57:47 +0200
commit158a492fd06ceed0566e3424aeb268a49149ac60 (patch)
tree334f2c03aaccd9ce6a9eb2bbf94899aa9cede239 /daemon/io.c
parentdaemon: proper connection closures on queue overflow (diff)
downloadknot-resolver-158a492fd06ceed0566e3424aeb268a49149ac60.tar.xz
knot-resolver-158a492fd06ceed0566e3424aeb268a49149ac60.zip
daemon/session2: add special event for OS buffer depletion
For the future, when we need to account for this for e.g. QUIC, which will need to handle this in the UDP case.
Diffstat (limited to 'daemon/io.c')
-rw-r--r--daemon/io.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/daemon/io.c b/daemon/io.c
index 6a72d049..86bd314e 100644
--- a/daemon/io.c
+++ b/daemon/io.c
@@ -165,15 +165,20 @@ static enum protolayer_event_cb_result pl_tcp_event_wrap(
enum protolayer_event_type event, void **baton,
struct session2 *session, void *sess_data)
{
- if (event == PROTOLAYER_EVENT_STATS_SEND_ERR) {
+ switch (event) {
+ case PROTOLAYER_EVENT_STATS_SEND_ERR:
the_worker->stats.err_tcp += 1;
return PROTOLAYER_EVENT_CONSUME;
- } else if (event == PROTOLAYER_EVENT_STATS_QRY_OUT) {
+ case PROTOLAYER_EVENT_STATS_QRY_OUT:
the_worker->stats.tcp += 1;
return PROTOLAYER_EVENT_CONSUME;
+ case PROTOLAYER_EVENT_OS_BUFFER_FULL:
+ session2_force_close(session);
+ return PROTOLAYER_EVENT_CONSUME;
+ default:
+ return PROTOLAYER_EVENT_PROPAGATE;
}
- return PROTOLAYER_EVENT_PROPAGATE;
}
__attribute__((constructor))