From: "Daniel P. Berrange" <berra...@redhat.com>

The I/O event callback processes incoming packets first, and then
does outgoing packets. If the incoming packet caused the stream to
close, then the attempt to process outgoing data resulted in an
error. This caused libvirt to then send an error back to the client,
but the stream had already been stopped. This confused the client
since it sees 2 error events.

* daemon/stream.c: Don't attempt read if stream is closed
---
 daemon/stream.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/daemon/stream.c b/daemon/stream.c
index 7dd9ae7..7d2b367 100644
--- a/daemon/stream.c
+++ b/daemon/stream.c
@@ -678,7 +678,15 @@ daemonStreamHandleRead(virNetServerClientPtr client,
     size_t bufferLen = VIR_NET_MESSAGE_PAYLOAD_MAX;
     int ret;
 
-    VIR_DEBUG("client=%p, stream=%p", client, stream);
+    VIR_DEBUG("client=%p, stream=%p tx=%d closed=%d",
+              client, stream, stream->tx, stream->closed);
+
+    /* We might have had an event pending before we shut
+     * down the stream, so if we're marked as closed,
+     * then do nothing
+     */
+    if (stream->closed)
+        return 0;
 
     /* Shouldn't ever be called unless we're marked able to
      * transmit, but doesn't hurt to check */
-- 
1.7.6

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

Reply via email to