[Spice-devel] [phodav PATCH 1/4] spice-webdavd: Don't show client folder, when sharing disabled

Lukas Venhoda lvenhoda at redhat.com
Thu Aug 27 09:25:50 PDT 2015


After enabling shared folder once, the Spice client folder stays in Nautilus,
until the spice-webdavd service si restarted.

This patch makes sure, that Spice client folder is disabled when sharing
is disabled, or the client disconnects.
---
No changes, just resending with the other patches.
---
 spice/spice-webdavd.c | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
index 742f9c9..c8fb795 100644
--- a/spice/spice-webdavd.c
+++ b/spice/spice-webdavd.c
@@ -222,6 +222,9 @@ static HANDLE port_handle;
 #endif

 static void start_mux_read (GInputStream *istream);
+#ifdef WITH_AVAHI
+static void mdns_unregister_service (void);
+#endif

 static void
 quit (int sig)
@@ -466,6 +469,9 @@ end:
       g_clear_error (&error);
     }

+#ifdef WITH_AVAHI
+  mdns_unregister_service ();
+#endif
   quit (-3);
 }

@@ -614,6 +620,24 @@ end:
 }

 static void
+mdns_unregister_service (void)
+{
+  GError *error = NULL;
+
+  if (mdns_group)
+    {
+      if (!ga_entry_group_reset (mdns_group, &error))
+        {
+          g_warning ("Could not disconnect MDNS service: %s", error->message);
+          g_clear_error (&error);
+        }
+
+      mdns_service = 0;
+      g_debug ("MDNS client disconected");
+    }
+}
+
+static void
 mdns_state_changed (GaClient *client, GaClientState state, gpointer user_data)
 {
   switch (state)
@@ -630,11 +654,7 @@ mdns_state_changed (GaClient *client, GaClientState state, gpointer user_data)
     case GA_CLIENT_STATE_S_COLLISION:
     case GA_CLIENT_STATE_S_REGISTERING:
       g_message ("MDNS collision");
-      if (mdns_group)
-        {
-          ga_entry_group_reset (mdns_group, NULL);
-          mdns_service = 0;
-        }
+      mdns_unregister_service ();
       break;

     default:
--
2.4.3



More information about the Spice-devel mailing list