[PATCH v2 1/2] Debug: Add DEBUG messages for when a client has opened/closed connection.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While tracing connections from a remote client, it helps to keep track
of the connection lifecycle. Messages such as the following :

error : virNetSocketReadWire:1574 : End of file while reading data: Input/output error

are rather unhelpful. They do not indicate if the client had earlier asked for
connection closure via libvirt API.
This patch introduces messages to annotate when a client connected/disconnected.

Signed-off-by: Prerna Saxena <saxenap.ltc@xxxxxxxxx>
---
 src/rpc/virnetserverclient.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 85857bc..24c9c33 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -964,8 +964,11 @@ void virNetServerClientClose(virNetServerClientPtr client)
     virNetServerClientCloseFunc cf;
     virKeepAlivePtr ka;
 
+    VIR_DEBUG("Free'ing up resources for client=%p sock=%d", client,
+               virNetServerClientGetFD(client));
+
     virObjectLock(client);
-    VIR_DEBUG("client=%p", client);
+
     if (!client->sock) {
         virObjectUnlock(client);
         return;
@@ -1039,10 +1042,14 @@ void virNetServerClientDelayedClose(virNetServerClientPtr client)
     virObjectLock(client);
     client->delayedClose = true;
     virObjectUnlock(client);
+    VIR_DEBUG("Client=%p sock=%d requested closure of connection.",
+              client, virNetServerClientGetFD(client));
 }
 
 void virNetServerClientImmediateClose(virNetServerClientPtr client)
 {
+    VIR_DEBUG("Client %p sock %d closed the connection", client,
+                virNetServerClientGetFD(client));
     virObjectLock(client);
     client->wantClose = true;
     virObjectUnlock(client);
@@ -1151,6 +1158,7 @@ static void virNetServerClientDispatchRead(virNetServerClientPtr client)
     if (client->rx->nfds == 0) {
         if (virNetServerClientRead(client) < 0) {
             client->wantClose = true;
+            VIR_WARN("Client=%p sock=%p closed connection", client, client->sock);
             return; /* Error */
         }
     }
-- 
1.8.1.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux