]> xenbits.xensource.com Git - libvirt.git/commitdiff
rpc: Report proper close reason
authorMartin Kletzander <mkletzan@redhat.com>
Sun, 30 Nov 2014 19:09:08 +0000 (20:09 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 8 Dec 2014 12:03:49 +0000 (13:03 +0100)
Whenever client socket was marked as closed for some reason, it could've
been changed when really closing the connection.  With this patch the
proper reason is kept since the first time it's marked as closed.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/rpc/virnetclient.c

index 8657b0ec6cbf8b3128cd61650784bbf157639d35..d7455b571d55a2584f3f3f3c572adc88b9f5782f 100644 (file)
@@ -634,8 +634,11 @@ virNetClientMarkClose(virNetClientPtr client,
     VIR_DEBUG("client=%p, reason=%d", client, reason);
     if (client->sock)
         virNetSocketRemoveIOCallback(client->sock);
-    client->wantClose = true;
-    client->closeReason = reason;
+    /* Don't override reason that's already set. */
+    if (!client->wantClose) {
+        client->wantClose = true;
+        client->closeReason = reason;
+    }
 }