]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virNetClientStreamQueuePacket: Set st->incomingEOF on the end of stream
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 6 Jun 2017 12:45:55 +0000 (14:45 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 7 Jun 2017 16:00:25 +0000 (18:00 +0200)
While reworking client side of streams, I had to postpone payload
decoding so that stream holes and stream data can be
distinguished in virNetClientStreamRecvPacket. That's merely what
18944b7aea46d does. However, I accidentally removed one important
bit: when server sends us an empty STREAM packet (with no
payload) - meaning end of stream - st->incomingEOF flag needs to
be set. It used to be before I touched the code. After I removed
it, virNetClientStreamRecvPacket will try to fetch more data from
the stream, but it will never come.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
src/rpc/virnetclientstream.c

index a9bf271dc5baa3e788470fa4139d81018cce86fc..54729c84fcd9457b453bb31c984b3b5d610c1492 100644 (file)
@@ -278,6 +278,15 @@ int virNetClientStreamQueuePacket(virNetClientStreamPtr st,
 
     VIR_DEBUG("Incoming stream message: stream=%p message=%p", st, msg);
 
+    if (msg->bufferLength == msg->bufferOffset) {
+        /* No payload means end of the stream. */
+        virObjectLock(st);
+        st->incomingEOF = true;
+        virNetClientStreamEventTimerUpdate(st);
+        virObjectUnlock(st);
+        return 0;
+    }
+
     /* Unfortunately, we must allocate new message as the one we
      * get in @msg is going to be cleared later in the process. */