From f4795a9bd8f488c5d32f9b171aa1d195bb4b8186 Mon Sep 17 00:00:00 2001 From: Alexander Chernavin Date: Fri, 22 Oct 2021 08:33:00 +0000 Subject: [PATCH] linux-cp: stop ignoring ENOBUFS while reading notif Type: improvement Currently, while reading notifications, ENOBUFS error is ignored and reading continues. This was done to minimize the number of notifications that are lost due to reopening the socket. Now that synchronization is implemented to recover from socket errors, ignoring ENOBUFS and reading as much notifications as possible is not actual. Before synchronization, all currently enqueued notification are discarded in any case. With this change, stop reading notifications if any error occurs. Signed-off-by: Alexander Chernavin Change-Id: I1184d9a3aa99df63ef59bc2a67be2b1e5e0e9329 --- src/plugins/linux-cp/lcp_nl.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/plugins/linux-cp/lcp_nl.c b/src/plugins/linux-cp/lcp_nl.c index 62868f35dc4..02954c362cf 100644 --- a/src/plugins/linux-cp/lcp_nl.c +++ b/src/plugins/linux-cp/lcp_nl.c @@ -717,15 +717,8 @@ lcp_nl_drain_messages (void) int err; nl_main_t *nm = &nl_main; - /* Read until there's an error. Unless the error is ENOBUFS, which means - * the kernel couldn't send a message due to socket buffer overflow. - * Continue reading when that happens. - * - * libnl translates both ENOBUFS and ENOMEM to NLE_NOMEM. So we need to - * check return status and errno to make sure we should keep going. - */ - while ((err = nl_recvmsgs_default (nm->sk_route)) > -1 || - (err == -NLE_NOMEM && errno == ENOBUFS)) + /* Read until there's an error */ + while ((err = nl_recvmsgs_default (nm->sk_route)) > -1) ; /* If there was an error other then EAGAIN, signal process node */ -- 2.16.6