GNOME Bugzilla – Bug 692516
Rescan feature needed in GSSDP
Last modified: 2019-02-22 09:29:21 UTC
It is currently not possible for GSSDP clients, such as a DMP, to easily force a rescan of the local area network. They may want to do this to discover new UPnP devices or to detect that existing devices are no longer available. Normally, such scans should not be necessary as devices should send alive and bye messages when they leave and join a network but it's always possible for these messages to get lost or to not be sent. For this reason, the ability to force a rescan is useful. I believe this feature would also be useful for certification as well. The only way to perform a rescan at the moment with GSSDP is to call gssdp_resource_browser_set_active twice, once with a value of FALSE, the second with TRUE. Unfortunately, this has the effect of removing and re-adding all the existing devices, which may not be what the user wants, particularly if outstanding commands have been issued on those devices. The solution would be to add a new method that issues a rescan without clearing the SSDP cache. Timers may be needed to remove devices from the cache that do not respond to the rescan in a reasonable amount of time.
Created attachment 236618 [details] [review] Adds a rescan function to GSSDPResourceBrowser
Created attachment 236620 [details] [review] Quick and dirty patch adding rescan button to gupnp-av-cp This patch is not meant to be a part of this bug - I made it for me to test the rescan feature. Unfortunately I don't have a service that doesn't announce itself. I would be grateful for some testing of it.
It's easy to simulate with ctrl-c-ing the fullscreen renderer I think
I simulated it with killing Rygel with SIGKILL instead. Fullscreen renderer as a standalone app does not show up in the renderers combo.
Well, fullscreen renderer shows up. I just forgot to pass network interface when executing it. Works with it as well.
(In reply to comment #5) > Well, fullscreen renderer shows up. I just forgot to pass network interface > when executing it. Works with it as well. Hm, good point. that needs an error message or a default.
Review of attachment 236618 [details] [review]: Some minor nitpicks, otherwise fine. ::: libgssdp/gssdp-resource-browser.c @@ +42,3 @@ #include "gssdp-marshal.h" +#define REASONABLE_AMOUNT_OF_TIME 5 /* 5 seconds */ Can we just call that RESCAN_TIMEOUT or something? @@ +599,3 @@ + **/ +gboolean + * Begins discovery if @resource_browser is active and no discovery is Function is missing from gtk-doc magic files @@ +1112,3 @@ + /* Setup a set of responsive resources for cache refreshing */ + resource_browser->priv->fresh_resources = g_hash_table_new_full + (g_str_hash, Indenting is off, probably tabs vs. spaces.
(In reply to comment #6) > (In reply to comment #5) > > Well, fullscreen renderer shows up. I just forgot to pass network interface > > when executing it. Works with it as well. > > Hm, good point. that needs an error message or a default. It has a default - eth0. I just forgot that this program takes any parameters. I had to pass "lo".
(In reply to comment #7) > Review of attachment 236618 [details] [review]: > > Some minor nitpicks, otherwise fine. > > ::: libgssdp/gssdp-resource-browser.c > @@ +42,3 @@ > #include "gssdp-marshal.h" > > +#define REASONABLE_AMOUNT_OF_TIME 5 /* 5 seconds */ > > Can we just call that RESCAN_TIMEOUT or something? Renamed. > @@ +599,3 @@ > + **/ > +gboolean > + * Begins discovery if @resource_browser is active and no discovery is > > Function is missing from gtk-doc magic files Added to sections file. > @@ +1112,3 @@ > + /* Setup a set of responsive resources for cache refreshing */ > + resource_browser->priv->fresh_resources = g_hash_table_new_full > + (g_str_hash, > > Indenting is off, probably tabs vs. spaces. That's actually an indenting rule of GUPnP stack.
Created attachment 236902 [details] [review] Adds a rescan function to GSSDPResourceBrowser v2
Review of attachment 236902 [details] [review]: Thanks. gaam
Review of attachment 236620 [details] [review]: Fine, Commit after the other patch