[PATCH RFC 27/48] 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 | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 445b7ce..0206510 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5242,7 +5242,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 f63072e..e8ef3a3 100644
--- a/src/rpc/virnetclientstream.c
+++ b/src/rpc/virnetclientstream.c
@@ -436,7 +436,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);
 
@@ -499,6 +499,15 @@ 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) {
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                           _("Stream is in a hole"));
+            rv = -3;
+            goto cleanup;
+        }
+
+
         if (len > st->skipLength)
             len = st->skipLength;
 
-- 
2.8.4

--
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]