diff options
author | Oto Šťáva <oto.stava@nic.cz> | 2024-06-11 16:45:24 +0200 |
---|---|---|
committer | Vladimír Čunát <vladimir.cunat@nic.cz> | 2024-07-22 17:57:47 +0200 |
commit | 158a492fd06ceed0566e3424aeb268a49149ac60 (patch) | |
tree | 334f2c03aaccd9ce6a9eb2bbf94899aa9cede239 /daemon/io.c | |
parent | daemon: proper connection closures on queue overflow (diff) | |
download | knot-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.c | 11 |
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)) |