Closed
Bug 1199564
Opened 10 years ago
Closed 10 years ago
start/stop mDNS service on demand
Categories
(Firefox OS Graveyard :: General, defect)
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)
|
6.11 KB,
patch
|
kershaw
:
review+
|
Details | Diff | Splinter Review |
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.
| Reporter | ||
Updated•10 years ago
|
| Assignee | ||
Comment 1•10 years ago
|
||
Assignee: nobody → kechang
Attachment #8656983 -
Flags: feedback?(xeonchen)
| Reporter | ||
Comment 2•10 years ago
|
||
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)
| Assignee | ||
Comment 3•10 years ago
|
||
(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.
| Assignee | ||
Comment 4•10 years ago
|
||
Hi Patrick,
Could you please take a look at this patch?
Thanks.
Attachment #8656983 -
Attachment is obsolete: true
Attachment #8657006 -
Flags: review?(mcmanus)
Comment 5•10 years ago
|
||
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+
| Assignee | ||
Comment 6•10 years ago
|
||
(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.
| Assignee | ||
Comment 7•10 years ago
|
||
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)
Updated•10 years ago
|
Attachment #8658557 -
Flags: review?(mcmanus) → review+
| Assignee | ||
Comment 8•10 years ago
|
||
Carry reviewer's name.
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=2cdff7699f6b
Attachment #8658557 -
Attachment is obsolete: true
Attachment #8659018 -
Flags: review+
| Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
| Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
| Assignee | ||
Comment 9•10 years ago
|
||
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)
| Assignee | ||
Comment 10•10 years ago
|
||
Updated•10 years ago
|
Attachment #8659197 -
Flags: review?(mcmanus) → review+
| Assignee | ||
Comment 11•10 years ago
|
||
Attachment #8659197 -
Attachment is obsolete: true
Attachment #8659199 -
Attachment is obsolete: true
Attachment #8659693 -
Flags: review+
| Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 12•10 years ago
|
||
Keywords: checkin-needed
Comment 13•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox43:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S7 (18Sep)
You need to log in
before you can comment on or make changes to this bug.
Description
•