Skip to content

Commit

Permalink
daemon/io: keep TCP data in system queue on buffer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukáš Ondráček committed Nov 6, 2024
1 parent 7b9be2f commit 1ea3f10
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions daemon/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1ea3f10

Please sign in to comment.