[Spice-commits] server/main-channel-client.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 3 09:27:42 UTC 2020


 server/main-channel-client.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit a6ccd2a3094b3910ba9f5405162b35d9340fe1a4
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Thu Nov 14 09:15:08 2019 +0000

    main-channel-client: Set state before sending ping messages
    
    It is not guaranteed that all the messages will be sent on a single
    push call, unless this is done very early.
    Although currently this function is called very early remove
    this hidden assumption in the code.
    "ping_id" is just incremented every time a message is sent to
    client (in "main_channel_marshall_ping") so the formulae
    "mcc->priv->ping_id - 2" was there to get the id of two messages
    ago (the first message queued in this function) assuming all
    messages were pushed at the time the formulae is used.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Snir Sheriber <ssheribe at redhat.com>

diff --git a/server/main-channel-client.c b/server/main-channel-client.c
index 2954036d..f535d175 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -263,12 +263,12 @@ void main_channel_client_start_net_test(MainChannelClient *mcc, int test_rate)
         return;
     }
 
+    mcc->priv->net_test_id = mcc->priv->ping_id + 1;
+    mcc->priv->net_test_stage = NET_TEST_STAGE_WARMUP;
+
     main_channel_client_push_ping(mcc, NET_TEST_WARMUP_BYTES);
     main_channel_client_push_ping(mcc, 0);
     main_channel_client_push_ping(mcc, NET_TEST_BYTES);
-
-    mcc->priv->net_test_id = mcc->priv->ping_id - 2;
-    mcc->priv->net_test_stage = NET_TEST_STAGE_WARMUP;
 }
 
 static RedPipeItem *red_ping_item_new(int size)


More information about the Spice-commits mailing list