[Spice-commits] 4 commits - server/main_channel.c server/red_dispatcher.c server/reds.c

Christophe Fergau teuf at kemper.freedesktop.org
Mon Jul 20 02:31:01 PDT 2015


 server/main_channel.c   |    9 +++++----
 server/red_dispatcher.c |    2 +-
 server/reds.c           |    5 +++--
 3 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 40537f6a3e3389b8377b0ae790c62ea0da8aa6d8
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Jul 15 14:15:52 2015 +0100

    reds: Assure we don't have stale statistic files before trying to create a new one
    
    If a previous Qemu executable is not able to delete the statistic file
    on the next creation with same name (statitics file are based on pid
    numbers so if pid get reused for another Qemu process you get the same
    name) it fails as you can't open a file with 0444 permissions (these
    are the permission used to create these files).
    This patch assure there are no stale file trying to remove it before the
    creation of the new one. As file is based on pid and name used for spice
    you are not deleting another file.
    
    Fixes: rhbz#1177326
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/reds.c b/server/reds.c
index 57ef07a..c74894a 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3291,6 +3291,7 @@ static int do_spice_init(SpiceCoreInterface *core_interface)
     shm_name_len = strlen(SPICE_STAT_SHM_NAME) + 20;
     reds->stat_shm_name = (char *)spice_malloc(shm_name_len);
     snprintf(reds->stat_shm_name, shm_name_len, SPICE_STAT_SHM_NAME, getpid());
+    shm_unlink(reds->stat_shm_name);
     if ((fd = shm_open(reds->stat_shm_name, O_CREAT | O_RDWR, 0444)) == -1) {
         spice_error("statistics shm_open failed, %s", strerror(errno));
     }
commit 660bee0e93598b322b219dd67b3bb35442b25c92
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Jul 15 16:32:28 2015 +0200

    server: spice_debug() messages don't need a trailing '\n'.
    
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>

diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index faa0d76..d2420cf 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -324,7 +324,7 @@ void red_dispatcher_client_monitors_config(VDAgentMonitorsConfig *monitors_confi
             !now->qxl->st->qif->client_monitors_config(now->qxl,
                                                        monitors_config)) {
             /* this is a normal condition, some qemu devices might not implement it */
-            spice_debug("QXLInterface::client_monitors_config failed\n");
+            spice_debug("QXLInterface::client_monitors_config failed");
         }
         now = now->next;
     }
diff --git a/server/reds.c b/server/reds.c
index 0867edb..57ef07a 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1002,11 +1002,11 @@ static void reds_on_main_agent_monitors_config(
     msg_header = (VDAgentMessage *)cmc->buffer;
     if (sizeof(VDAgentMessage) > cmc->buffer_size ||
             msg_header->size > cmc->buffer_size - sizeof(VDAgentMessage)) {
-        spice_debug("not enough data yet. %d\n", cmc->buffer_size);
+        spice_debug("not enough data yet. %d", cmc->buffer_size);
         return;
     }
     monitors_config = (VDAgentMonitorsConfig *)(cmc->buffer + sizeof(*msg_header));
-    spice_debug("%s: %d\n", __func__, monitors_config->num_of_monitors);
+    spice_debug("%s: %d", __func__, monitors_config->num_of_monitors);
     red_dispatcher_client_monitors_config(monitors_config);
     reds_client_monitors_config_cleanup();
 }
commit 212ee28a641e521e9618f017d3ed611818073c28
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Jul 15 16:38:15 2015 +0200

    server: Weakly try to get a better latency value for the bandwidth test.
    
    NET_TEST_WARMUP_BYTES is 0 so the warmup ping is the same as the one we
    use to measure the latency. Even if it was not, the actual latency would
    be the MIN() of both anyway so we might as well use both roundtrip times
    to ward off latency jitter a bit.
    
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>

diff --git a/server/main_channel.c b/server/main_channel.c
index bbe96c9..12009f3 100644
--- a/server/main_channel.c
+++ b/server/main_channel.c
@@ -961,11 +961,12 @@ static int main_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, uint
             case NET_TEST_STAGE_WARMUP:
                 mcc->net_test_id++;
                 mcc->net_test_stage = NET_TEST_STAGE_LATENCY;
+                mcc->latency = roundtrip;
                 break;
             case NET_TEST_STAGE_LATENCY:
                 mcc->net_test_id++;
                 mcc->net_test_stage = NET_TEST_STAGE_RATE;
-                mcc->latency = roundtrip;
+                mcc->latency = MIN(mcc->latency, roundtrip);
                 break;
             case NET_TEST_STAGE_RATE:
                 mcc->net_test_id = 0;
commit 1a8a7df286c36bedd8938dabceb0fbab22ba0cf6
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Jul 15 16:34:00 2015 +0200

    server: Don't reset the latency before showing it in the invalid net test error message.
    
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>

diff --git a/server/main_channel.c b/server/main_channel.c
index 54718ba..bbe96c9 100644
--- a/server/main_channel.c
+++ b/server/main_channel.c
@@ -971,11 +971,11 @@ static int main_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, uint
                 mcc->net_test_id = 0;
                 if (roundtrip <= mcc->latency) {
                     // probably high load on client or server result with incorrect values
+                    spice_printerr("net test: invalid values, latency %" PRIu64
+                                   " roundtrip %" PRIu64 ". assuming high"
+                                   " bandwidth", mcc->latency, roundtrip);
                     mcc->latency = 0;
                     mcc->net_test_stage = NET_TEST_STAGE_INVALID;
-                    spice_printerr("net test: invalid values, latency %" PRIu64
-                               " roundtrip %" PRIu64 ". assuming high"
-                               "bandwidth", mcc->latency, roundtrip);
                     red_channel_client_start_connectivity_monitoring(&mcc->base,
                                                                      CLIENT_CONNECTIVITY_TIMEOUT);
                     break;


More information about the Spice-commits mailing list