Skip to content
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

SLD without {sdp} reads [[LastCreatedOffer/Answer]] at the wrong time #2208

Closed
jan-ivar opened this issue Jun 14, 2019 · 0 comments · Fixed by #2209
Closed

SLD without {sdp} reads [[LastCreatedOffer/Answer]] at the wrong time #2208

jan-ivar opened this issue Jun 14, 2019 · 0 comments · Fixed by #2209
Assignees

Comments

@jan-ivar
Copy link
Member

The current prose on setLocalDescription reads [[LastCreatedOffer]] and [[LastCreatedAnswer]] on method entry. This is the wrong time, and may produce the wrong result if other methods are enqueued. For example, it would fail in the FIFO peer case:

io.onmessage = async ({data: {description, candidate}}) => {
  if (description) {
    await Promise.all([                           // ←- avoids race!
      pc.setRemoteDescription(description),       // ←- 
      pc.createAnswer(),                          // ←- 
      pc.setLocalDescription({type: "answer"})    // ←- unusual, works today
    ]);                                           // ←- 

Here, all three promise-returning negotiation methods are invoked at the same time, which means setLocalDescription would read [[LastCreatedAnswer]] before the createAnswer has succeeded (or even begun the in-parallel part of its algorithm). This would cause SLD to either fail (if [[LastCreatedAnswer]] was null, or apply an outdated answer.

Instead, we need to read these internal slots in the enqueued steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant