[spice-server 1/3] Remove unneeded rcc->priv->latency_monitor.timer checks

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

 



red_channel_client_start_ping_timer(), red_channel_client_cancel_ping_timer(),
red_channel_client_restart_ping_timer() are no-ops when
rcc->priv->latency_monitor.timer is NULL, so there is no need to
explicitly check it's not NULL before calling these functions.

Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
---
 server/red-channel-client.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 802cd46..f9054ea 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -257,6 +257,9 @@ static void red_channel_client_restart_ping_timer(RedChannelClient *rcc)
 {
     uint64_t passed, timeout;
 
+    if (!rcc->priv->latency_monitor.timer) {
+        return;
+    }
     passed = (spice_get_monotonic_time_ns() - rcc->priv->latency_monitor.last_pong_time) / NSEC_PER_MILLISEC;
     timeout = PING_TEST_IDLE_NET_TIMEOUT_MS;
     if (passed  < PING_TEST_TIMEOUT_MS) {
@@ -649,8 +652,7 @@ static void red_channel_client_msg_sent(RedChannelClient *rcc)
         spice_assert(rcc->priv->send_data.header.data != NULL);
         red_channel_client_begin_send_message(rcc);
     } else {
-        if (rcc->priv->latency_monitor.timer
-            && !red_channel_client_is_blocked(rcc)
+        if (!red_channel_client_is_blocked(rcc)
             && g_queue_is_empty(&rcc->priv->pipe)) {
             /* It is possible that the socket will become idle, so we may be able to test latency */
             red_channel_client_restart_ping_timer(rcc);
@@ -969,9 +971,7 @@ static void red_channel_client_seamless_migration_done(RedChannelClient *rcc)
     rcc->priv->wait_migrate_data = FALSE;
 
     if (red_client_seamless_migration_done_for_channel(rcc->priv->client)) {
-        if (rcc->priv->latency_monitor.timer) {
-            red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
-        }
+        red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
         if (rcc->priv->connectivity_monitor.timer) {
             SpiceCoreInterfaceInternal *core = red_channel_get_core_interface(rcc->priv->channel);
             core->timer_start(core, rcc->priv->connectivity_monitor.timer,
@@ -982,9 +982,7 @@ static void red_channel_client_seamless_migration_done(RedChannelClient *rcc)
 
 void red_channel_client_semi_seamless_migration_complete(RedChannelClient *rcc)
 {
-    if (rcc->priv->latency_monitor.timer) {
-        red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
-    }
+    red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
 }
 
 bool red_channel_client_is_waiting_for_migrate_data(RedChannelClient *rcc)
-- 
2.9.3

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