[PATCH server 6/7] spicevmc: handle any possible future compression sending compressed data

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

 



From: Frediano Ziglio <fziglio@xxxxxxxxxx>

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/spicevmc.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/server/spicevmc.c b/server/spicevmc.c
index 28ea8e9..19ce4c6 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -462,27 +462,19 @@ static void spicevmc_red_channel_send_data(RedChannelClient *rcc,
 {
     RedVmcPipeItem *i = SPICE_UPCAST(RedVmcPipeItem, item);
 
-    switch (i->type) {
-    case SPICE_DATA_COMPRESSION_TYPE_NONE:
+    /* for compatibility send using not compressed data message */
+    if (i->type == SPICE_DATA_COMPRESSION_TYPE_NONE) {
         red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_DATA, item);
-        spice_marshaller_add_ref(m, i->buf, i->buf_used);
-        break;
-    case SPICE_DATA_COMPRESSION_TYPE_LZ4: {
-        SpiceMsgCompressedData compressed_msg;
-
+    } else {
+        /* send as compressed */
         red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_COMPRESSED_DATA, item);
-        compressed_msg.type = SPICE_DATA_COMPRESSION_TYPE_LZ4;
-        compressed_msg.uncompressed_size = i->uncompressed_data_size;
-        compressed_msg.compressed_size = i->buf_used;
-
+        SpiceMsgCompressedData compressed_msg = {
+            .type = i->type,
+            .uncompressed_size = i->uncompressed_data_size
+        };
         spice_marshall_SpiceMsgCompressedData(m, &compressed_msg);
-        spice_marshaller_add_ref(m, i->buf, i->buf_used);
-        break;
-     }
-     default:
-         g_assert_not_reached();
     }
-
+    spice_marshaller_add_ref(m, i->buf, i->buf_used);
 }
 
 static void spicevmc_red_channel_send_migrate_data(RedChannelClient *rcc,
-- 
2.5.5

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]