[gnome-remote-desktop] rdp/nw-auto: Only create ping source if required and non-existent



commit 51e94ba8dfaa3d6daf31cb982e40e4e0439acb71
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Wed Nov 3 12:28:26 2021 +0100

    rdp/nw-auto: Only create ping source if required and non-existent
    
    When updating the ping source, gnome-remote-desktop clears the previous
    GSource first, if it is required.
    If it is not required, then gnome-remote-desktop won't clear the
    existing GSource.
    This behaviour is correct. However, when it is not required to update
    the ping source, gnome-remote-desktop will still attempt to create a
    new GSource and replace the existing GSource with the new one.
    The old GSource will then remain to exist and cannot be removed any
    more, since no reference to that GSource is left.
    
    Fix this behaviour by just returning from the function in such
    situation.
    Currently, gnome-remote-desktop does not run into this situation, since
    it seems that all known RDP clients seem to behave well with the
    SuppressOutput PDU.

 src/grd-rdp-network-autodetection.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/grd-rdp-network-autodetection.c b/src/grd-rdp-network-autodetection.c
index 3eb30a6..32713b8 100644
--- a/src/grd-rdp-network-autodetection.c
+++ b/src/grd-rdp-network-autodetection.c
@@ -166,9 +166,11 @@ update_ping_source (GrdRdpNetworkAutodetection *network_autodetection)
       g_clear_pointer (&network_autodetection->ping_source, g_source_unref);
     }
 
-  if (network_autodetection->rtt_consumers == GRD_RDP_NW_AUTODETECT_RTT_CONSUMER_NONE)
+  if (network_autodetection->rtt_consumers == GRD_RDP_NW_AUTODETECT_RTT_CONSUMER_NONE ||
+      network_autodetection->ping_interval == new_ping_interval_type)
     return;
 
+  g_assert (!network_autodetection->ping_source);
   emit_ping (network_autodetection);
 
   switch (new_ping_interval_type)


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