[spice-server v1 2/2] mcc: early return and lower indentation

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

 



main_channel_client_start_net_test() checks MainChannelClient already
which is the single reason why main_channel_client_push_ping() could
fail. Reorganizing this code a little bit.
---
 server/main-channel-client.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/server/main-channel-client.c b/server/main-channel-client.c
index 20cf932..fd4802a 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -142,16 +142,18 @@ void main_channel_client_start_net_test(MainChannelClient *mcc, int test_rate)
     if (!mcc || mcc->net_test_id) {
         return;
     }
-    if (test_rate) {
-        if (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->net_test_id = mcc->ping_id - 2;
-            mcc->net_test_stage = NET_TEST_STAGE_WARMUP;
-        }
-    } else {
+
+    if (!test_rate) {
         red_channel_client_start_connectivity_monitoring(&mcc->base, CLIENT_CONNECTIVITY_TIMEOUT);
+        return;
     }
+
+    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->net_test_id = mcc->ping_id - 2;
+    mcc->net_test_stage = NET_TEST_STAGE_WARMUP;
 }
 
 static RedPipeItem *red_ping_item_new(int size)
-- 
2.7.4

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