Closed Bug 1199564 Opened 10 years ago Closed 10 years ago

start/stop mDNS service on demand

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox43 fixed)

RESOLVED FIXED
FxOS-S7 (18Sep)
Tracking Status
firefox43 --- fixed

People

(Reporter: xeonchen, Assigned: kershaw)

References

Details

Attachments

(1 file, 6 obsolete files)

In https://bugzilla.mozilla.org/show_bug.cgi?id=1196884#c6, it mentioned that mdnsd is still launched. The reason is |nsDNSServiceDiscovery| always keep mdnsd alive, so we should launch mdnsd only when necessary. To fix this, mdnsd should be started/stopped on demand. Also make sure resources are not leaked if the service is stopped while mDNS resolution requests are still waiting for response.
See Also: → 1172383, 1196884
Blocks: 1196884
Attached patch start stop mDNS on demand (obsolete) — Splinter Review
Assignee: nobody → kechang
Attachment #8656983 - Flags: feedback?(xeonchen)
Comment on attachment 8656983 [details] [diff] [review] start stop mDNS on demand Review of attachment 8656983 [details] [diff] [review]: ----------------------------------------------------------------- ::: netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.cpp @@ +38,5 @@ > property_set("ctl.stop", "mdnsd"); > } > > +static uint32_t sUseCount = 0; > + suggest to keep it private in the class, and make sure its thread-safety, e.g. use mozilla::Atomic @@ +44,5 @@ > +{ > +protected: > + RequestBase() > + { > + if (sUseCount++) { inverse this condition? @@ +62,2 @@ > class DiscoveryRequest final : public nsICancelable > + , public RequestBase Is it required to be public? @@ +96,5 @@ > return NS_OK; > } > > class RegisterRequest final : public nsICancelable > + , public RequestBase ditto
Attachment #8656983 - Flags: feedback?(xeonchen)
(In reply to Gary Chen [:xeonchen] from comment #2) > Comment on attachment 8656983 [details] [diff] [review] > start stop mDNS on demand > > Review of attachment 8656983 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.cpp > @@ +38,5 @@ > > property_set("ctl.stop", "mdnsd"); > > } > > > > +static uint32_t sUseCount = 0; > > + > > suggest to keep it private in the class, and make sure its thread-safety, > e.g. use mozilla::Atomic > Thanks. It's a good suggestion. > @@ +44,5 @@ > > +{ > > +protected: > > + RequestBase() > > + { > > + if (sUseCount++) { > > inverse this condition? > Yes, you are right. > @@ +62,2 @@ > > class DiscoveryRequest final : public nsICancelable > > + , public RequestBase > > Is it required to be public? > No, it can also be private.
Attached patch start stop mDNS on demand (obsolete) — Splinter Review
Hi Patrick, Could you please take a look at this patch? Thanks.
Attachment #8656983 - Attachment is obsolete: true
Attachment #8657006 - Flags: review?(mcmanus)
Comment on attachment 8657006 [details] [diff] [review] start stop mDNS on demand Review of attachment 8657006 [details] [diff] [review]: ----------------------------------------------------------------- what's the threading model here that means you need the atomic?
Attachment #8657006 - Flags: review?(mcmanus) → review+
(In reply to Patrick McManus [:mcmanus] from comment #5) > Comment on attachment 8657006 [details] [diff] [review] > start stop mDNS on demand > > Review of attachment 8657006 [details] [diff] [review]: > ----------------------------------------------------------------- > > what's the threading model here that means you need the atomic? Thanks for reviewing. Actually, it's should be main thread only. I think we don't need atomic here. An unsigned integer and MOZ_ASSERT(NS_IsMainThread()) should be enough. I'll update the patch later.
Attached patch start stop mDNS on demand - v2 (obsolete) — Splinter Review
Summary of changes: 1. Change the type to static uint32_t 2. Add MOZ_ASSERT(NS_IsMainThread()) in constructor and destructor
Attachment #8657006 - Attachment is obsolete: true
Attachment #8658557 - Flags: review?(mcmanus)
Attachment #8658557 - Flags: review?(mcmanus) → review+
Attachment #8658557 - Attachment is obsolete: true
Attachment #8659018 - Flags: review+
Keywords: checkin-needed
Keywords: checkin-needed
Attached patch start stop mDNS on demand - v3 (obsolete) — Splinter Review
Hi Patrick, Sorry that I have to ask you to review again. I forgot to move creating request earlier than calling operator function. Without this, mdns service will never have a chance to start.
Attachment #8659018 - Attachment is obsolete: true
Attachment #8659197 - Flags: review?(mcmanus)
Attached patch Interdiff of v3 and v2 (obsolete) — Splinter Review
Attachment #8659197 - Flags: review?(mcmanus) → review+
Attachment #8659197 - Attachment is obsolete: true
Attachment #8659199 - Attachment is obsolete: true
Attachment #8659693 - Flags: review+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S7 (18Sep)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: