[gnome-network-displays/benzea/fix-p2p-find-stop] wfd-p2p-provider: Do not stop find for all state changes




commit faa9f5e7f1cf1b7d45afb0d64aa2b827f343991b
Author: Benjamin Berg <benjamin sipsolutions net>
Date:   Thu Sep 15 18:08:22 2022 +0200

    wfd-p2p-provider: Do not stop find for all state changes
    
    Previously, we would explicitly start/stop the find operation when the
    underlying NMDevice state changed. However, this causes frequent stop
    operations to be emitted, which appears to interfer with connection
    attempts at a lower level.
    
    Change it to only emit a stop find if the find restart logic is running.
    
    This was changed in commit e870aad3 ("wfd-p2p-provider: Only start
    discovery when device available").
    
    Fixes: #257

 src/nd-wfd-p2p-provider.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/nd-wfd-p2p-provider.c b/src/nd-wfd-p2p-provider.c
index 475e0a9..e4dd210 100644
--- a/src/nd-wfd-p2p-provider.c
+++ b/src/nd-wfd-p2p-provider.c
@@ -189,12 +189,19 @@ discovery_start_stop (NdWFDP2PProvider *provider, NMDeviceState state)
     }
   else
     {
-      g_debug ("WFDP2PProvider: Stopping P2P discovery.");
       if (provider->p2p_find_source_id)
-        g_source_remove (provider->p2p_find_source_id);
-      provider->p2p_find_source_id = 0;
-
-      nm_device_wifi_p2p_stop_find (NM_DEVICE_WIFI_P2P (provider->nm_device), NULL, NULL, NULL);
+        {
+          g_debug ("WFDP2PProvider: Stopping P2P discovery.");
+          g_source_remove (provider->p2p_find_source_id);
+          provider->p2p_find_source_id = 0;
+
+          /* FIXME (upstream): Calling stop find for every state changes causes
+           * the connection to fail. While this was never a good idea,
+           * it does mean that something is going wrong elsewhere (likely
+           * in wpa_supplicant).
+           */
+          nm_device_wifi_p2p_stop_find (NM_DEVICE_WIFI_P2P (provider->nm_device), NULL, NULL, NULL);
+        }
     }
 }
 


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