summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2016-04-24 16:28:18 -0400
committerCole Robinson <crobinso@redhat.com>2016-05-02 10:13:05 -0400
commit66a03d0af2dbb8a5f8afc51a97ac8fd2895a0697 (patch)
treef7109c8ba658cf545f9334947c0bfae8614f9d56 /daemon
parent8958dde506bab3c854acd8b66d422406191bd3c9 (diff)
downloadlibvirt-66a03d0af2dbb8a5f8afc51a97ac8fd2895a0697.tar.gz
daemon: stream: Don't force error when client aborts
Every time a client aborts a stream via the virStreamAbort API, the daemon always logs an error like: error : daemonStreamHandleAbort:617 : stream aborted at client request and that same error is returned to the client. Meaning virStreamAbort always returns -1, which seems strange. This reworks the error handling to only raise an error on virStreamAbort if the actual server side abort call raises an error. This is similar to how virStreamFinish works. If the abort code path is triggered by an unexpected message type then we continue to raise an unconditional error. Also drop a redundant VIR_WARN call there, since virReportError will raise a VIR_ERROR anyways
Diffstat (limited to 'daemon')
-rw-r--r--daemon/stream.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/daemon/stream.c b/daemon/stream.c
index fcec3d0608..bd0b5d2229 100644
--- a/daemon/stream.c
+++ b/daemon/stream.c
@@ -611,29 +611,40 @@ daemonStreamHandleAbort(virNetServerClientPtr client,
{
VIR_DEBUG("client=%p, stream=%p, proc=%d, serial=%u",
client, stream, msg->header.proc, msg->header.serial);
- virNetMessageError rerr;
-
- memset(&rerr, 0, sizeof(rerr));
+ int ret;
+ bool raise_error = false;
stream->closed = true;
virStreamEventRemoveCallback(stream->st);
- virStreamAbort(stream->st);
+ ret = virStreamAbort(stream->st);
if (msg->header.status == VIR_NET_ERROR) {
- virReportError(VIR_ERR_RPC,
- "%s", _("stream aborted at client request"));
+ VIR_INFO("stream aborted at client request");
+ raise_error = (ret < 0);
} else {
- VIR_WARN("unexpected stream status %d", msg->header.status);
virReportError(VIR_ERR_RPC,
_("stream aborted with unexpected status %d"),
msg->header.status);
+ raise_error = true;
}
- return virNetServerProgramSendReplyError(remoteProgram,
- client,
- msg,
- &rerr,
- &msg->header);
+ if (raise_error) {
+ virNetMessageError rerr;
+ memset(&rerr, 0, sizeof(rerr));
+ return virNetServerProgramSendReplyError(remoteProgram,
+ client,
+ msg,
+ &rerr,
+ &msg->header);
+ } else {
+ /* Send zero-length confirm */
+ return virNetServerProgramSendStreamData(stream->prog,
+ client,
+ msg,
+ stream->procedure,
+ stream->serial,
+ NULL, 0);
+ }
}