New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistencies and race conditions in updating negotiation-needed flag #1332
Comments
It's intended more to handle cases like this:
I agree that there should be an explanation for how |
Got it. I think I misread step 6.2 as "set Closing this issue. |
Actually, I realized a potential race condition when looking at the example code. Suppose Now, suppose the remote offer arrives first, and In short: It's not quite enough to say "abort these steps if the signaling state isn't |
@taylor-b Naively it seems to be in the app domain to avoid the inherent glare between "offer now" and an incoming offer, so |
@jan-ivar I guess you're right. Even if we address the scenario I described by pushing So I'll close this again for the time being. |
In some cases, the
negotiationneeded
event could be fired twice when there is only one needed.The part that confuse me is in step 10 for setting session description:
[[ needNegotiation]]
slot was true both before and after this update, queue a task that runs the following steps:2. If connection's
[[needNegotiation]]
slot is false, abort these steps.3. Fire a simple event named
negotiationneeded
at connection.The steps are similar but not entirely the same as the firing event step in the steps to update the negotiation-needed flag. The rationale for this step seems to be to defer the
negotiationneeded
event to be fired only when the connection go back to stable state. But it doesn't make sense together with step 2 in updating the negotiation-needed flag:The step seems to suggest that for any SDP changes when the connection state is not stable, the
[[needNegotiation]]
internal slot is never updated and thenegotiationneeded
event is never fired.So it is not clear when the condition applies for connection's
[[needNegotiation]]
slot was true both before and after the session description update. The only cases that I can think of is by creating race conditions, e.g.:createOffer()
.createDataChannel()
oraddTransceiver()
. This will manage to get past "If connection's signaling state is not "stable", abort these steps.", because the connection state is still stable, and [[needNegotiation]] is then set to true.setLocalDescription()
in parallel. This sets the description without the newly created m= section.setRemoteDescription()
with answer to change the connection back to stable state. The condition for last step of setting session description applies, and a secondnegotiationneeded
event is fired.I am not sure if the scenario happens by design or by accident. Would be better if there are additional non-normative section to describe how the
negotiationneeded
event should be handled, and describe the event behavior in a human-friendly way.The text was updated successfully, but these errors were encountered: