[Spice-devel] [PATCH server 4/7] spicevmc: avoid to send data not compressible with LZ4

Snir Sheriber ssheribe at redhat.com
Sun May 29 14:30:16 UTC 2016


From: Frediano Ziglio <fziglio at redhat.com>

Send uncompressed instead.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/spicevmc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/server/spicevmc.c b/server/spicevmc.c
index dce0dc6..d7ef5ba 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -144,7 +144,7 @@ static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeI
                                                  n,
                                                  BUF_SIZE);
 
-    if (compressed_data_count > 0) {
+    if (compressed_data_count > 0 && compressed_data_count < n) {
         msg_item_compressed->type = SPICE_DATA_COMPRESSION_TYPE_LZ4;
         msg_item_compressed->uncompressed_data_size = n;
         msg_item_compressed->buf_used = compressed_data_count;
@@ -152,8 +152,7 @@ static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeI
         return msg_item_compressed;
     }
 
-    /* LZ4 compression failed-fallback a non-compressed data is to be sent */
-    spice_warning("Compress Error");
+    /* LZ4 compression failed or did non compress, fallback a non-compressed data is to be sent */
     free(msg_item_compressed);
     return NULL;
 }
-- 
2.5.5



More information about the Spice-devel mailing list