[webrtc-pc] State gaps in connectionState algorithm (#2827)

jan-ivar has just created a new issue for https://github.com/w3c/webrtc-pc:

== State gaps in connectionState algorithm ==
There are a gaps in the [RTCPeerConnectionStates](https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectionstate-closed) between `"new"`, `"connecting"` and `"connected"` if:
1. All ICE transports are in `"new"` or `"closed"`, and any DTLS transport is in `"connected"`, or
2. Any ICE transports are in `"new"` or `"closed"`, and all DTLS transports are `"connected"`

These don't match any state in the table:

|Enum | Description |
-- | --
new | None of the previous states apply and all [RTCIceTransport](https://w3c.github.io/webrtc-pc/#dom-rtcicetransport)s are in the "[new](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-new)" or "[closed](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-closed)" state, and all [RTCDtlsTransport](https://w3c.github.io/webrtc-pc/#dom-rtcdtlstransport)s are in the "[new](https://w3c.github.io/webrtc-pc/#dom-rtcdtlstransportstate-new)" or "[closed](https://w3c.github.io/webrtc-pc/#dom-rtcdtlstransportstate-closed)" state, or there are no transports.
connecting | None of the previous states apply and any [RTCIceTransport](https://w3c.github.io/webrtc-pc/#dom-rtcicetransport) is in the "[new](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-new)" or "[checking](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-checking)" state or any [RTCDtlsTransport](https://w3c.github.io/webrtc-pc/#dom-rtcdtlstransport) is in the "[new](https://w3c.github.io/webrtc-pc/#dom-rtcdtlstransportstate-new)" or "[connecting](https://w3c.github.io/webrtc-pc/#dom-rtcdtlstransportstate-connecting)" state.
| connected | None of the previous states apply and all [RTCIceTransport](https://w3c.github.io/webrtc-pc/#dom-rtcicetransport)s are in the "[connected](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-connected)", "[completed](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-completed)" or "[closed](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-closed)" state, and all [RTCDtlsTransport](https://w3c.github.io/webrtc-pc/#dom-rtcdtlstransport)s are in the "[connected](https://w3c.github.io/webrtc-pc/#dom-rtcdtlstransportstate-connected)" or "[closed](https://w3c.github.io/webrtc-pc/#dom-rtcdtlstransportstate-closed)" state. |

They seem impossible in practice if DTLS intrinsically depends in ICE, so this may be editorial mostly, but this isn't spelled out in the spec. Also, with n-dimensional corner cases like rollback x ICE restart x bundle renegotiation x whatever SDP negotiation mechanism may be cooked up to handle re-keying DTLS, it might be good to clean this up a bit.

One solution: reverse the order of the last two and make the latter a catch-all:
|Enum | Description |
-- | --
| connected | None of the previous states apply and all [RTCIceTransport](https://w3c.github.io/webrtc-pc/#dom-rtcicetransport)s are in the "[connected](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-connected)", "[completed](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-completed)" or "[closed](https://w3c.github.io/webrtc-pc/#dom-rtcicetransportstate-closed)" state, and all [RTCDtlsTransport](https://w3c.github.io/webrtc-pc/#dom-rtcdtlstransport)s are in the "[connected](https://w3c.github.io/webrtc-pc/#dom-rtcdtlstransportstate-connected)" or "[closed](https://w3c.github.io/webrtc-pc/#dom-rtcdtlstransportstate-closed)" state. |
connecting | None of the previous states apply.

This also conveniently avoids mentioning the `"checking"` ICE state which has no equivalent.

Also, after https://github.com/w3c/webrtc-pc/pull/2036 aligned `connectionState` with `iceConnectionState` it might be simpler to express one using the other, to help readers grasp their relationship, since (unlike [originally intended](https://github.com/w3c/webrtc-pc/pull/291#issuecomment-138771616)) we're likely stuck with both.

Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2827 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 13 February 2023 23:39:17 UTC