diff options
author | Lukáš Ondráček <lukas.ondracek@nic.cz> | 2024-11-06 18:26:14 +0100 |
---|---|---|
committer | Lukáš Ondráček <lukas.ondracek@nic.cz> | 2024-11-06 18:26:14 +0100 |
commit | 1ea3f10cd0d8668ff1f19fc397f78a7929648403 (patch) | |
tree | b68e00b59f8d0116ab443d0ffb33fe2b02b164f4 /daemon/io.c | |
parent | daemon/defer: enable defer by default (diff) | |
download | knot-resolver-1ea3f10cd0d8668ff1f19fc397f78a7929648403.tar.xz knot-resolver-1ea3f10cd0d8668ff1f19fc397f78a7929648403.zip |
daemon/io: keep TCP data in system queue on buffer overflow
Diffstat (limited to 'daemon/io.c')
-rw-r--r-- | daemon/io.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/daemon/io.c b/daemon/io.c index 36648907..98500c34 100644 --- a/daemon/io.c +++ b/daemon/io.c @@ -324,6 +324,20 @@ static void tcp_recv(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf) return; } + if (nread == UV_ENOBUFS) { + /* No space available in session buffer. + * The connection may be just waiting in defer. + * Ignore the error and keep the data in system queue for later reading or timeout. */ + if (kr_log_is_debug(IO, NULL)) { + struct sockaddr *peer = session2_get_peer(s); + char *peer_str = kr_straddr(peer); + kr_log_debug(IO, "=> incoming data from '%s' waiting (%s)\n", + peer_str ? peer_str : "", + uv_strerror(nread)); + } + return; + } + if (nread < 0 || !buf->base) { if (kr_log_is_debug(IO, NULL)) { struct sockaddr *peer = session2_get_peer(s); |