[phodav PATCH v2] spice-webdavd: Don't show client folder, when sharing disabled

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

 



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.
---
Changes since v1:
 - Fixed build on windows
   - Forgot to ifdef the new function
 - Fixed missing space before ()
 - Added error checking
---
 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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://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]