原文链接:https://datatracker.ietf.org/doc/html/rfc8445#section-8
8、Concluding ICE Processing 【协商ICE的处理】
This section describes how an ICE agent completes ICE.
本节介绍 ICE 代理如何完成 ICE。
8.1. Procedures for Full Implementations【完整实现的过程】
Concluding ICE involves nominating pairs by the controlling agent and updating state machinery.
协商ICE 涉及由控制代理指派的候选对和更新状态机制。
8.1.1. Nominating Pairs【指定对】
Prior to nominating, the controlling agent lets connectivity checks continue until some stopping criterion is met.
在指派之前,控制代理让连接检查继续进行,直到满足某些停止标准。
After that, based on an evaluation criterion, the controlling agent picks a pair among the valid pairs in the valid list for nomination.
之后,基于评估标准,控制代理从有效列表中的有效对中选择一对进行提名。
Once the controlling agent has picked a valid pair for nomination, it repeats the connectivity check that produced this valid pair (by enqueueing the pair that generated the check into the triggered-check queue), this time with the USE-CANDIDATE attribute (Section 7.2.5.3.4).
一旦控制代理选择了一个有效的对进行指派,它就会重复产生这个有效对的连接性检查(通过将生成检查的对入队到触发检查队列中),这次使用 USE-CANDIDATE 属性(第 7.2.5.3.4节)。
The procedures for the controlled agent are described in Section 7.3.1.5.
受控代理的程序在第 7.3.1.5 节中描述。
Eventually, if the nominations succeed, both the controlling and controlled agents will have a single nominated pair in the valid list for each component of the data stream.
最终,如果指派成功,控制代理和受控代理将在数据流的每个组件的有效列表中都有一个指定对。
Once an ICE agent sets the state of the checklist to Completed (when there is a nominated pair for each component of the data stream), that pair becomes the selected pair for that agent and is used for sending and receiving data for that component of the data stream.
一旦 ICE 代理将检查表的状态设置为已完成(当数据流的每个组件都有一个指定对时),该对就成为该代理的选定对,并用于发送和接收该组件的数据流的数据。
If an agent is not able to produce selected pairs for each component of a data stream, the agent MUST take proper actions for informing the other agent, e.g., by removing the stream.
如果代理不能为数据流的每个组件生成选定的对,代理必须采取适当的措施通知其他代理,例如,通过删除流。
The exact actions are outside the scope of this specification. The criteria for stopping the connectivity checks and for picking a pair for nomination are outside the scope of this specification.
确切的操作超出了本规范的范围。停止连通性检查和选择一对指定的标准超出了本规范的范围。
They are a matter of local optimization.
它们是局部优化的问题。
The only requirement is that the agent MUST eventually pick one and only one candidate pair and generate a check for that pair with the USE-CANDIDATE attribute set.
唯一的要求是代理必须最终选择一个且只有一个候选对,并使用 USE-CANDIDATE 属性集为该对生成一个检查。
Once the controlling agent has successfully nominated a candidate pair (Section 7.2.5.3.4), the agent MUST NOT nominate another pair for same component of the data stream within the ICE session.
一旦控制代理成功地指派了一个候选对(第 7.2.5.3.4 节),代理不得为 ICE 会话中数据流的相同组件指派另一对。
Doing so requires an ICE restart.
这样做需要重启 ICE。
A controlling agent that does not support this specification (i.e., it is implemented according to RFC 5245) might nominate more than one candidate pair.
不支持此规范的控制代理(即根据 RFC 5245 实施)可能会提名多个候选对。
This was referred to as “aggressive nomination” in RFC 5245. If more than one candidate pair is nominated by the controlling agent, and if the controlled agent accepts multiple nominations requests, the agents MUST produce the selected pairs and use the pairs with the highest priority.
这在 RFC 5245 中被称为“积极指派”。如果控制代理指派了多个候选对,并且如果受控代理接受多个指派请求,则代理必须生成选定的对并使用最高的对优先事项。
The usage of the ‘ice2’ ICE option (Section 10) by endpoints supporting this specification is supposed to prevent controlling agents that are implemented according to RFC 5245 from using aggressive nomination.
支持本规范的端点使用“ice2”ICE 选项(第 10 节)应该防止根据 RFC 5245 实施的控制代理使用激进的指派。
NOTE: In RFC 5245, usage of “aggressive nomination” allowed agents to continuously nominate pairs, before a pair was eventually selected, in order to allow sending of data on those pairs.
注意:在 RFC 5245 中,“积极提名”的使用允许代理在最终选择一对之前连续指定对,以便允许在这些对上发送数据。
In this specification, data can always be sent on any valid pair, without nomination.
在本规范中,数据总是可以在任何有效对上发送,无需指定。
Hence, there is no longer a need for aggressive nomination.
因此,不再需要“积极指派”。
8.1.2. Updating Checklist and ICE States【更新检查表和ICE状态】
For both a controlling and a controlled agent, when a candidate pair for a component of a data stream gets nominated, it might impact other pairs in the checklist associated with the data stream.
对于控制代理和受控代理,当数据流组件的候选对被指派时,可能影响与数据流关联的检查表中其他对。
It might also impact the state of the checklist:
它还可能影响检查表的状态:
- Once a candidate pair for a component of a data stream has been nominated, and the state of the checklist associated with the data stream is Running, the ICE agent MUST remove all candidate pairs for the same component from the checklist and from the triggered- check queue.
一旦数据流的一个组件的候选对被指派,并且与数据流相关的检查表的状态为运行,ICE 代理必须从检查表和触发的-中删除同一组件的所有候选对检查队列。
If the state of a pair is In-Progress, the agent cancels the In-Progress transaction. Cancellation means that the agent will not retransmit the Binding requests associated with the connectivity-check transaction, will not treat the lack of response to be a failure, but will wait the duration of the transaction timeout for a response.
如果一对的状态是进行中,代理会取消进行中的事务。取消意味着代理不会重新传输与连接检查事务相关的绑定请求,不会将缺少响应视为失败,而是会等待事务超时的持续时间以获取响应。 - Once candidate pairs for each component of a data stream have been nominated, and the state of the checklist associated with the data stream is Running, the ICE agent sets the state of the checklist to Completed.
一旦数据流的每个组件的候选对已被指派,并且与数据流相关的检查表的状态为正在运行,ICE 代理将检查表的状态设置为已完成。 - Once a candidate pair for a component of a data stream has been nominated, an agent MUST continue to respond to any Binding request it might still receive for the nominated pair and for any remaining candidate pairs in the checklist associated with the data stream.
一旦一个数据流组件的候选对被指派,代理必须继续响应它可能仍然收到的任何绑定请求,该请求对和与数据流相关的检查表中的任何剩余候选对。
As defined in Section 7.3.1.4, when the state of a pair is Succeeded, an agent will no longer generate triggered checks when receiving a Binding request for the pair.
如第 7.3.1.4 节中所定义,当对的状态为成功时,代理在接收到对的绑定请求时将不再生成触发检查。
Once the state of each checklist in the checklist set is Completed, the agent sets the state of the ICE session to Completed.
一旦检查表集中每个检查表的状态为已完成,代理将 ICE 会话的状态设置为已完成。
If the state of a checklist is Failed, ICE has not been able to successfully complete the process for the data stream associated with the checklist.
如果检查表的状态为失败,ICE 无法成功完成与清单关联的数据流的过程。
The correct behavior depends on the state of the checklists in the checklist set. If the controlling agent wants to continue the session without the data stream associated with the Failed checklist, and if there are still one or more checklists in Running or Completed mode, the agent can let the ICE processing continue.
正确的行为取决于检查表集中检查表的状态。如果控制代理想要在没有与失败检查表关联的数据流的情况下继续会话,并且如果仍有一个或多个检查表处于运行或已完成模式,则代理可以让 ICE 处理继续。
The agent MUST take proper actions for removing the failed data stream.
代理必须采取适当的措施来删除失败的数据流。
If the controlling agent does not want to continue the session and MUST terminate the session, the state of the ICE session is set to Failed.
如果控制代理不想继续会话并且必须终止会话,则 ICE 会话的状态设置为失败。
If the state of each checklist in the checklist set is Failed, the state of the ICE session is set to Failed.
如果检查表集中每个检查表的状态为失败,则 ICE 会话的状态设置为失败。
Unless the controlling agent wants to continue the session without the data streams, it MUST terminate the session.
除非控制代理想要在没有数据流的情况下继续会话,否则它必须终止会话。
8.2. Procedures for Lite Implementations【精简实现的过程】
When ICE concludes, a lite ICE agent can free host candidates that were not used by ICE, as described in Section 8.3.
当 ICE 结束时,精简版ICE 代理可以释放 ICE 未使用的host候选者,如第 8.3 节所述。
If the peer is a full agent, once the lite agent accepts a nomination request for a candidate pair, the lite agent considers the pair nominated.
如果对等体是完整代理,则一旦精简代理接受对候选对的指派请求,精简代理就会认为该对被指定。
Once there are nominated pairs for each component of a data stream, the pairs become the selected pairs for the components of the data stream.
一旦为数据流的每个组件指定了对,这些对就成为数据流组件的选定对。
Once the lite agent has produced selected pairs for all components of all data streams, the ICE session state is set to Completed.
一旦精简代理为所有数据流的所有组件生成了选定的对,ICE 会话状态将设置为 Completed。
If the peer is a lite agent, the agent pairs local candidates with remote candidates that are of the same data stream and have the same component, transport protocol, and IP address family.
如果对等体是精简代理,则代理将本地候选与具有相同数据流并具有相同组件、传输协议和 IP 地址系列的远端候选配对。
For each component of each data stream, if there is only one candidate pair, that pair is added to the valid list.
对于每个数据流的每个组件,如果只有一个候选对,则将该对添加到有效列表中。
If there is more than one pair, it is RECOMMENDED that an agent follow the procedures of RFC6724 [RFC6724] to select a pair and add it to the valid list.
如果有一对以上,建议代理按照 RFC6724 [RFC6724] 的程序选择一对并将其添加到有效列表中。
If all of the components for all data streams had one pair, the state of ICE processing is Completed. Otherwise, the controlling agent MUST send an updated candidate list to reconcile different agents selecting different candidate pairs.
如果所有数据流的所有组件都有一对,则 ICE 处理的状态为 Completed。 否则,控制代理必须发送一个更新的候选列表来协调选择不同候选对的不同代理。
ICE processing is complete after and only after the updated candidate exchange is complete.
ICE 处理在且仅在更新的候选交换完成之后才完成。
8.3. Freeing Candidates【释放候选对象】
8.3.1. Full Implementation Procedures【完整实现的过程】
The rules in this section describe when it is safe for an agent to cease sending or receiving checks on a candidate that did not become a selected candidate (i.e., is not associated with a selected pair) and when to free the candidate.
本节中的规则描述了代理何时可以安全地停止发送或接收未成为选定候选(即,与选定对的对)的检查以及何时释放候选对象。
Once a checklist has reached the Completed state, the agent SHOULD wait an additional three seconds, and then it can cease responding to checks or generating triggered checks on all local candidates other than the ones that became selected candidates.
一旦检查表达到 Completed 状态,代理应该再等待三秒钟,然后它可以停止响应检查或对所有本地候选者产生触发检查,而不是成为指定候选的那些。
Once all ICE sessions have ceased using a given local candidate (a candidate may be used by multiple ICE sessions, e.g., in forking scenarios), the agent can free that candidate.
一旦所有 ICE 会话都停止使用给定的本地候选(一个候选可能被多个 ICE 会话使用,例如,在分叉场景中),代理可以释放该候选对象。
The three-second delay handles cases when aggressive nomination is used, and the selected pairs can quickly change after ICE has completed.
三秒延迟处理使用积极指派的情况,所选对可以在 ICE 完成后快速更改。
Freeing of server-reflexive candidates is never explicit; it happens by lack of a keepalive.
释放server-reflexive候选从来都不明确; 它是由于缺乏保活而发生的。
8.3.2. Lite Implementation Procedures【精简实现的过程】
A lite implementation can free candidates that did not become selected candidates as soon as ICE processing has reached the Completed state for all ICE sessions using those candidates.
对于使用这些候选的所有 ICE 会话,一旦 ICE 处理达到 Completed 状态,精简实现可以释放没有成为指定候选的候选。