mctp-demux-daemon: Silence warnings on remote close
If applications constantly connect then disconnect from the demux daemon
we see a "flood" of messages like:
Mar 05 07:15:47 w57 mctp-demux[177]: mctp-demux-daemon: can't receive(peek) from client: Connection reset by peer
Mar 05 07:15:52 w57 mctp-demux[177]: mctp-demux-daemon: can't receive(peek) from client: Connection reset by peer
Mar 05 07:15:52 w57 mctp-demux[177]: mctp-demux-daemon: can't receive(peek) from client: Connection reset by peer
Mar 05 07:15:53 w57 mctp-demux[177]: mctp-demux-daemon: can't receive(peek) from client: Connection reset by peer
Mar 05 07:15:54 w57 mctp-demux[177]: mctp-demux-daemon: can't receive(peek) from client: Connection reset by peer
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I99eabffd45693e5ab570575c4c8cca2ee55196e0
diff --git a/utils/mctp-demux-daemon.c b/utils/mctp-demux-daemon.c
index d223279..b7500b5 100644
--- a/utils/mctp-demux-daemon.c
+++ b/utils/mctp-demux-daemon.c
@@ -4,6 +4,7 @@
#include <assert.h>
#include <err.h>
+#include <errno.h>
#include <getopt.h>
#include <poll.h>
#include <stdbool.h>
@@ -326,7 +327,9 @@
len = recv(client->sock, NULL, 0, MSG_PEEK | MSG_TRUNC);
if (len < 0) {
- warn("can't receive(peek) from client");
+ if (errno != ECONNRESET)
+ warn("can't receive (peek) from client");
+
rc = -1;
goto out_close;
}
@@ -346,7 +349,8 @@
rc = recv(client->sock, ctx->buf, ctx->buf_size, 0);
if (rc < 0) {
- warn("can't receive from client");
+ if (errno != ECONNRESET)
+ warn("can't receive from client");
rc = -1;
goto out_close;
}