The protocol may not use an explicit API to close the connection and
just close the socket instead. Add option to suppress errors in such
case.
---
src/rpc/virnetserverclient.c | 13 +++++++++++++
src/rpc/virnetserverclient.h | 2 ++
2 files changed, 15 insertions(+)
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 81da82cab..85857bc3e 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -1637,3 +1637,16 @@ virNetServerClientGetInfo(virNetServerClientPtr client,
virObjectUnlock(client);
return ret;
}
+
+
+/**
+ * virNetServerClientSetQuietEOF:
+ *
+ * Don't report errors for protocols that close connection by hangup of the
+ * socket rather than calling an API to close it.
+ */
+void
+virNetServerClientSetQuietEOF(virNetServerClientPtr client)
+{
+ virNetSocketSetQuietEOF(client->sock);
+}
diff --git a/src/rpc/virnetserverclient.h b/src/rpc/virnetserverclient.h
index a53cc00b2..e45c78882 100644
--- a/src/rpc/virnetserverclient.h
+++ b/src/rpc/virnetserverclient.h
@@ -152,4 +152,6 @@ int virNetServerClientGetInfo(virNetServerClientPtr client,
bool *readonly, char **sock_addr,
virIdentityPtr *identity);
+void virNetServerClientSetQuietEOF(virNetServerClientPtr client);
+
#endif /* __VIR_NET_SERVER_CLIENT_H__ */
--
2.12.0