Clarify rules for 'adding an available service' and 'removing an available service' from http://lists.w3.org/Archives/Public/public-device-apis/2012Oct/0020.html
--- a/discovery-api/Overview.src.html Mon Feb 04 14:00:59 2013 +0100
+++ b/discovery-api/Overview.src.html Mon Feb 04 15:18:11 2013 +0100
@@ -971,18 +971,19 @@
</h2>
<p>
A <a>user agent</a> conforming to this specification MAY implement <abbr title=
- "Simple Service Discovery Protocol">SSDP</abbr> [[!UPNP-DEVICEARCH11]], Zeroconf [[!DNS-SD]] + [[!MDNS]] or
+ "Simple Service Discovery Protocol">SSDP</abbr> [[!UPNP-DEVICEARCH11]], Zeroconf [[!DNS-SD]] + [[!MDNS]] and/or
<abbr title="Discovery and Launch Protocol">DIAL</abbr> [<a href=
"https://sites.google.com/a/dial-multiscreen.org/dial/dial-protocol-specification">DIAL</a>] <dfn>service
discovery mechanisms</dfn> - the requirements detailed in this section of the specification - to enable Web
- pages to request and connect with HTTP services running on networked devices, discovered via either mechanism,
- through this API. When a <a>user agent</a> implements either of these <a>service discovery mechanisms</a>, then
- it MUST conform to the corresponding algorithms provided in this section of the specification.
+ pages to request and connect with HTTP services running on networked devices, discovered via any of these
+ mechanisms, through this API. When a <a>user agent</a> implements any of these <a>service discovery
+ mechanisms</a>, then it MUST conform to the corresponding algorithms provided in this section of the
+ specification.
</p>
<p>
- This section presents how the results of these two <a>service discovery mechanisms</a> will be matched to
- requested service types, how the user agent stores available and active services and how their properties are
- applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
+ This section presents how the results of these <a>service discovery mechanisms</a> will be matched to requested
+ service types, how the user agent stores available and active services and how their properties are applied to
+ any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
</p>
<p>
It is expected that user agents will perform these <a>service discovery mechanisms</a> asynchronously and
@@ -1009,13 +1010,11 @@
</p>
<p>
The rule for <dfn>adding an available service</dfn> is the process of adding a new service or updating an
- existing service in the <a>list of available service records</a> that is generally available on the user's
- current network. This rule takes one argument, <var>network service record</var>, and consists of running the
+ existing service that is generally available on the user's current network in the <a>list of available service
+ records</a>. This rule takes one argument, <var>network service record</var>, and consists of running the
following steps:
</p>
<ol class="rule">
- <li>Let <var>new service registration flag</var> be <code>true</code>.
- </li>
<li>For each <var>existing service record</var> in the current <a>list of available service records</a>, run
the following sub-steps:
<ol class="rule">
@@ -1023,19 +1022,17 @@
service record</var>'s <code>id</code> property then abort any remaining sub-steps and continue at the next
available <var>existing service record</var>.
</li>
- <li>Set <var>new service registration flag</var> to <code>false</code>.
- </li>
<li>Replace the value of <var>existing service record</var> in the current <a>list of available service
- records</a> with the value of <var>network service record</var>.
+ records</a> with the value of <var>network service record</var>, aborting any remaining steps in this
+ algorithm and return.
</li>
</ol>
</li>
- <li>If <var>new service registration flag</var> is set to <code>true</code> then add <var>network service
- record</var> to the <a>list of available service records</a> as a new item.
+ <li>Add <var>network service record</var> to the <a>list of available service records</a> as a new item.
</li>
<li>For each <var>service manager</var> in the <a>list of active service managers</a> run the following steps:
<ol class="rule">
- <li>Let <var>service type in current service manager flag</var> be <code>false</code>.
+ <li>Let <var>'service type in current service manager' flag</var> be <code>false</code>.
</li>
<li>For each <var>active service</var> in <var>service manager</var> run the following steps:
<ol class="rule">
@@ -1043,12 +1040,10 @@
service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this <var>active
service</var> and continue at the next available <var>active service</var>.
</li>
- <li>Set the <var>service type in current service manager flag</var> to <code>true</code>.
+ <li>Set the <var>'service type in current service manager' flag</var> to <code>true</code>.
</li>
- <li>If the <var>new service registration flag</var> is set to <code>false</code>, the <var>network
- service record</var>'s <code>id</code> property equals the <var>active service</var>'s <code>id</code>
- attribute and <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a>
- attribute is currently set to <code>false</code> then set <var>active service</var>'s <a href=
+ <li>If the <var>network service record</var>'s <code>id</code> property equals the <var>active
+ service</var>'s <code>id</code> attribute then set <var>active service</var>'s <a href=
"#dom-networkservice-online"><code>online</code></a> attribute to <code>true</code> and then <a href=
"http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
@@ -1059,11 +1054,10 @@
</li>
</ol>
</li>
- <li>If the <var>new service registration flag</var> is set to <code>true</code> and the <var>service type
- in current service manager flag</var> is also set to <code>true</code> then increment <var>service
- manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a>
- attribute by <code>1</code> and then <a href=
- "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
+ <li>If the <var>'service type in current service manager' flag</var> is set to <code>true</code> then
+ increment <var>service manager</var>'s <a href=
+ "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and
+ then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
"#event-serviceavailable"><code>serviceavailable</code></a> that uses the <a href=
"http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
@@ -1095,7 +1089,7 @@
<li>For each <var>service manager</var> in the <a>list of active service managers</a> run the following
steps:
<ol class="rule">
- <li>Let <var>service type in current service manager flag</var> be <code>false</code>.
+ <li>Let <var>'service type in current service manager' flag</var> be <code>false</code>.
</li>
<li>For each <var>active service</var> in <var>service manager</var> run the following steps:
<ol class="rule">
@@ -1103,7 +1097,7 @@
<var>active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this
<var>active service</var> and continue at the next available <var>active service</var>.
</li>
- <li>Set the <var>service type in current service manager flag</var> to <code>true</code>.
+ <li>Set the <var>'service type in current service manager' flag</var> to <code>true</code>.
</li>
<li>If <var>existing service record</var>'s <code>id</code> property equals the <var>active
service</var>'s <code>id</code> attribute and <var>active service</var>'s <a href=
@@ -1119,7 +1113,7 @@
</li>
</ol>
</li>
- <li>If the <var>service type in current service manager flag</var> is set to <code>true</code> then
+ <li>If the <var>'service type in current service manager' flag</var> is set to <code>true</code> then
decrement <var>service manager</var>'s <a href=
"#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code>
and then <a href=