[PATCH v2 31/38] remote_driver: Implement VIR_STREAM_RECV_STOP_AT_HOLE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/remote/remote_driver.c   | 2 +-
 src/rpc/virnetclientstream.c | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 376e9ba..fd76811 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -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;
diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
index ff35137..18d7cbc 100644
--- a/src/rpc/virnetclientstream.c
+++ b/src/rpc/virnetclientstream.c
@@ -434,7 +434,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);
 
@@ -497,6 +497,13 @@ int virNetClientStreamRecvPacket(virNetClientStreamPtr st,
         /* Pretend skipLength 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->skipLength)
             len = st->skipLength;
 
-- 
2.10.2

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux