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 <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2014-11-30 20:09:08 +01:00
parent 48abdf5de7
commit f127138038
1 changed files with 5 additions and 2 deletions

View 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;
}
}