[PATCH 08/27] Track if stream is seekable

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

 



Even though there's no way how to make stream seekable right now,
it is going to be soon. We need to track this info so that we
don't send virStreamSkip to a client that did not want it or vice
versa.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 daemon/remote.c              | 2 +-
 daemon/stream.c              | 6 +++++-
 daemon/stream.h              | 3 ++-
 src/remote/remote_driver.c   | 6 ++++--
 src/rpc/gendispatch.pl       | 4 ++--
 src/rpc/virnetclientstream.c | 6 +++++-
 src/rpc/virnetclientstream.h | 3 ++-
 7 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index fde029d..e2e08aa 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -4948,7 +4948,7 @@ remoteDispatchDomainMigratePrepareTunnel3Params(virNetServerPtr server ATTRIBUTE
 
     if (!(st = virStreamNew(priv->conn, VIR_STREAM_NONBLOCK)) ||
         !(stream = daemonCreateClientStream(client, st, remoteProgram,
-                                            &msg->header)))
+                                            &msg->header, false)))
         goto cleanup;
 
     if (virDomainMigratePrepareTunnel3Params(priv->conn, st, params, nparams,
diff --git a/daemon/stream.c b/daemon/stream.c
index c892dcb..02729e4 100644
--- a/daemon/stream.c
+++ b/daemon/stream.c
@@ -52,6 +52,8 @@ struct daemonClientStream {
     virNetMessagePtr rx;
     bool tx;
 
+    bool seekable;
+
     daemonClientStreamPtr next;
 };
 
@@ -319,7 +321,8 @@ daemonClientStream *
 daemonCreateClientStream(virNetServerClientPtr client,
                          virStreamPtr st,
                          virNetServerProgramPtr prog,
-                         virNetMessageHeaderPtr header)
+                         virNetMessageHeaderPtr header,
+                         bool seekable)
 {
     daemonClientStream *stream;
     daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client);
@@ -337,6 +340,7 @@ daemonCreateClientStream(virNetServerClientPtr client,
     stream->serial = header->serial;
     stream->filterID = -1;
     stream->st = st;
+    stream->seekable = seekable;
 
     return stream;
 }
diff --git a/daemon/stream.h b/daemon/stream.h
index cf76e71..bf5dc24 100644
--- a/daemon/stream.h
+++ b/daemon/stream.h
@@ -30,7 +30,8 @@ daemonClientStream *
 daemonCreateClientStream(virNetServerClientPtr client,
                          virStreamPtr st,
                          virNetServerProgramPtr prog,
-                         virNetMessageHeaderPtr hdr);
+                         virNetMessageHeaderPtr hdr,
+                         bool seekable);
 
 int daemonFreeClientStream(virNetServerClientPtr client,
                            daemonClientStream *stream);
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index b7fd869..a3c331e 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5597,7 +5597,8 @@ remoteDomainMigratePrepareTunnel3(virConnectPtr dconn,
     if (!(netst = virNetClientStreamNew(st,
                                         priv->remoteProgram,
                                         REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3,
-                                        priv->counter)))
+                                        priv->counter,
+                                        false)))
         goto done;
 
     if (virNetClientAddStream(priv->client, netst) < 0) {
@@ -6522,7 +6523,8 @@ remoteDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
     if (!(netst = virNetClientStreamNew(st,
                                         priv->remoteProgram,
                                         REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS,
-                                        priv->counter)))
+                                        priv->counter,
+                                        false)))
         goto cleanup;
 
     if (virNetClientAddStream(priv->client, netst) < 0) {
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 10fde25..f2fa467 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -976,7 +976,7 @@ elsif ($mode eq "server") {
             print "    if (!(st = virStreamNew(priv->conn, VIR_STREAM_NONBLOCK)))\n";
             print "        goto cleanup;\n";
             print "\n";
-            print "    if (!(stream = daemonCreateClientStream(client, st, remoteProgram, &msg->header)))\n";
+            print "    if (!(stream = daemonCreateClientStream(client, st, remoteProgram, &msg->header, false)))\n";
             print "        goto cleanup;\n";
             print "\n";
         }
@@ -1654,7 +1654,7 @@ elsif ($mode eq "client") {
 
         if ($call->{streamflag} ne "none") {
             print "\n";
-            print "    if (!(netst = virNetClientStreamNew(st, priv->remoteProgram, $call->{constname}, priv->counter)))\n";
+            print "    if (!(netst = virNetClientStreamNew(st, priv->remoteProgram, $call->{constname}, priv->counter, false)))\n";
             print "        goto done;\n";
             print "\n";
             print "    if (virNetClientAddStream(priv->client, netst) < 0) {\n";
diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
index 8920395..06d91d1 100644
--- a/src/rpc/virnetclientstream.c
+++ b/src/rpc/virnetclientstream.c
@@ -54,6 +54,8 @@ struct _virNetClientStream {
     virNetMessagePtr rx;
     bool incomingEOF;
 
+    bool seekable; /* User requested seekable stream */
+
     virNetClientStreamEventCallback cb;
     void *cbOpaque;
     virFreeCallback cbFree;
@@ -138,7 +140,8 @@ virNetClientStreamEventTimer(int timer ATTRIBUTE_UNUSED, void *opaque)
 virNetClientStreamPtr virNetClientStreamNew(virStreamPtr stream,
                                             virNetClientProgramPtr prog,
                                             int proc,
-                                            unsigned serial)
+                                            unsigned serial,
+                                            bool seekable)
 {
     virNetClientStreamPtr st;
 
@@ -152,6 +155,7 @@ virNetClientStreamPtr virNetClientStreamNew(virStreamPtr stream,
     st->prog = prog;
     st->proc = proc;
     st->serial = serial;
+    st->seekable = seekable;
 
     virObjectRef(prog);
 
diff --git a/src/rpc/virnetclientstream.h b/src/rpc/virnetclientstream.h
index e278dab..0a5aafd 100644
--- a/src/rpc/virnetclientstream.h
+++ b/src/rpc/virnetclientstream.h
@@ -35,7 +35,8 @@ typedef void (*virNetClientStreamEventCallback)(virNetClientStreamPtr stream,
 virNetClientStreamPtr virNetClientStreamNew(virStreamPtr stream,
                                             virNetClientProgramPtr prog,
                                             int proc,
-                                            unsigned serial);
+                                            unsigned serial,
+                                            bool seekable);
 
 bool virNetClientStreamRaiseError(virNetClientStreamPtr st);
 
-- 
2.8.1

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