[phodav] spice-webdavd: Safer MDNS Unregister
- From: Victor Toso de Carvalho <victortoso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [phodav] spice-webdavd: Safer MDNS Unregister
- Date: Thu, 24 Mar 2016 10:06:25 +0000 (UTC)
commit 9952e58d7bbb03a64c6a9e31db855e4630a626ae
Author: Lukas Venhoda <lvenhoda redhat com>
Date: Thu Mar 17 14:47:45 2016 +0100
spice-webdavd: Safer MDNS Unregister
Add error handling when unregistering folder from file explorer.
Move unregistering to a function.
Acked-by: Marc-André Lureau <mlureau redhat com>
Acked-by: Victor Toso <victortoso redhat com>
spice/spice-webdavd.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
index 742f9c9..68f3cf0 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)
@@ -614,6 +617,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 +651,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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]