This CL changes the DataChannel closing procedure to match the standard. As a result,
if you close a DataChannel from a new version of WebRTC, and the other endpoint is using an old version, it will be stuck in the "closing" state. This is already what happens if you close a DataChannel from Firefox and the other side is Chrome (as Firefox is already doing the correct procedure). But if this is a problem, let us know and we can consider ways to mitigate it.
This change will hit M69, and can be tested in a Canary build today.
For those who are interested...
The correct procedure is:
- Alice resets outgoing stream.
- Bob sees incoming stream reset, resets his outgoing stream.
- For each side, after both outgoing/incoming streams are reset, state changes from "closing" to "closed".
But instead, we've been doing:
- Alice resets outgoing stream *and* incoming stream, and immediately sets state to "closed" (even before acknowledgement is received).
- Bob sees incoming stream reset, sets state to "closed".
As a result, if Alice is a standards-compliant endpoint and Bob isn't, Bob won't reset his outgoing stream, and Alice will keep waiting for that indefinitely. Hence the highlighted issue.