]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
remote_driver: Implement VIR_STREAM_RECV_STOP_AT_HOLE
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 20 May 2016 14:44:22 +0000 (16:44 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 18 May 2017 05:42:13 +0000 (07:42 +0200)
This is fairly trivial now that we have everything in place.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/remote/remote_driver.c
src/rpc/virnetclientstream.c

index dc59034c3b0bd48c65036104631ae39aaeb611c8..d27e96ffc2b71a3d2bd169c46b22077c3d227650 100644 (file)
@@ -5652,7 +5652,7 @@ remoteStreamRecvFlags(virStreamPtr st,
     virNetClientStreamPtr privst = st->privateData;
     int rv;
 
-    virCheckFlags(0, -1);
+    virCheckFlags(VIR_STREAM_RECV_STOP_AT_HOLE, -1);
 
     if (virNetClientStreamRaiseError(privst))
         return -1;
index c22b6661e5962a50fa66154bcce86c425ffbdede..7b28d63db0a18615012eda99ab5165a18ec4cbaa 100644 (file)
@@ -468,7 +468,7 @@ int virNetClientStreamRecvPacket(virNetClientStreamPtr st,
     VIR_DEBUG("st=%p client=%p data=%p nbytes=%zu nonblock=%d flags=%x",
               st, client, data, nbytes, nonblock, flags);
 
-    virCheckFlags(0, -1);
+    virCheckFlags(VIR_STREAM_RECV_STOP_AT_HOLE, -1);
 
     virObjectLock(st);
 
@@ -532,6 +532,13 @@ int virNetClientStreamRecvPacket(virNetClientStreamPtr st,
         /* Pretend holeLength zeroes was read from stream. */
         size_t len = want;
 
+        /* Yes, pretend unless we are asked not to. */
+        if (flags & VIR_STREAM_RECV_STOP_AT_HOLE) {
+            /* No error reporting here. Caller knows what they are doing. */
+            rv = -3;
+            goto cleanup;
+        }
+
         if (len > st->holeLength)
             len = st->holeLength;