The current discovery frontend API just exposes a |listServices| method, which assumes that discovery is always happening. Provide API methods for frontend to start and stop discovery, and callbacks to inform the frontend of the changing list of services.
Created attachment 8731451 [details] [diff] [review] improve-mdns-discovery-api.patch Initial patch. This cleans up the FlyWebMDNSService's discovery logic, and exposes a FlyWebDiscoveryManager API that allows for startDiscovery() and stopDiscovery() with a callback. The startDiscovery() and stopDiscovery() webidl functions don't do anything yet.
Created attachment 8732374 [details] [diff] [review] improve-mdns-discovery-api.patch Ok this pretty much fixes up the discovery chrome API to work on a "id = startDiscovery(callback)", "stopDiscovery(id)" model, with active updates delivered via the callback. The UI frontend is really responsive, and discovery shuts down when the UI is not open. I did notice some weirdness with the Android frontend. The frontend view's "show"/"hide" functions aren't invoked consistently in correspondence with navigating to the FlyWeb view and away from it. That should be fixed, but that's just an interaction between the Java and browser.js code. Will file a bug to fix it.
Created attachment 8732375 [details] [diff] [review] improve-mdns-discovery-api.patch Did not post the right patch. This is the right one.
Kannan - you seem to be actively working on this; please change my whiteboard annotation to necko-backlog if not. Thanks.