Re: [webrtc-pc] Can onicecandidate fire before SLD.then(code)? (#2574)

> Is this a testing-only issue or could this cause races in real applications too (assuming slow processing time of SLD and 0 ms connection with a super-computer)?

This is largely a question about signalling protocols and when you signal the local description. You *must not* signal ice candidates before the initial offer, otherwise this will cause addIceCandidate before setRemoteDescription (assuming the signaling protocol gets that far even).

You can do either of two things here. First,
```
pc.createOffer()
  .then(offer => pc.setLocalDescription(offer))
  .then(() => /* signal offer */)
})
```
In that case, if onicecandidate fires before SLD resolves its bad as described above.

The other case is that you assume that setLocalDescription can not throw with the given offer:
```
pc.createOffer()
  .then(offer => {
      /* signal offer */
     return pc.setLocalDescription(offer);
  })
  .then(() => /* no op */)
```
Now we have largely removed the reasons for SLD erroring for reasons between createOffer and SLD. In practice they still exist however because munging.

-- 
GitHub Notification of comment by fippo
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2574#issuecomment-691443002 using your GitHub account


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

Received on Saturday, 12 September 2020 08:18:30 UTC