From: Martin Kletzander Date: Sun, 30 Nov 2014 19:09:08 +0000 (+0100) Subject: rpc: Report proper close reason X-Git-Tag: v1.2.11-rc1~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f1271380381bb49b4a4c38950fe77a60d19ea9a3;p=thirdparty%2Flibvirt.git rpc: Report proper close reason 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 --- diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 8657b0ec6c..d7455b571d 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -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; + } }