-
Notifications
You must be signed in to change notification settings - Fork 12
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
The same connection.peerIdentity promise can be resolved multiple times #3
Comments
Comment by @martinthomson If there is a target peer identity or the promise resolves (those are the two cases), then the promise should be left alone if it is already resolved. There is no new information to provide. In the former case, |
Comment by @soareschen I think the wordings can be more explicit instead of relying on the implicit behavior of promises. e.g. "If Still, it doesn't solve the first case where peer identity is set but first call to identity validation fails. // target peer identity is established during construction
const pc = new RTCPeerConnection({ peerIdentity: ... })
pc.setRemoteDescription(sdpWithInvalidAssertion) // first SRD fails
.catch(() => pc.setRemoteDescription(sdpWithValidAssertion)) // second SRD succeeds
.then(pc.peerIdentity)
.catch(err => ...); // pc.peerIdentity stays rejected forever Relevant paragraphs:
So if validation fails and there is a target peer identity, the rejected Probably a better way to cover all failure cases is:
|
Comment by @martinthomson Hmm, that changes things subtly. It means that if you set a target peer identity, then you can keep trying to set a remote description. I can't see a problem with that right now. |
Comment by @soareschen Does the original definition not allow setting remote description multiple times if target peer identity is set? |
Comment by @martinthomson I just looked at the spec and while my understanding was that resolving or rejecting a promise was a noop if it was settled, that is only true for the resolution and rejection functions. So I've refactored this code a little. |
Raised by @soareschen
In 9.4 Verifying Identity Assertions:
Identity assertion validation is performed every time
setRemoteDescription()
is called with SDP containing a=identity line. Whether the validation succeed or failed, 9.4 attempts to resolveconnection.peerIdentity
promise without considering if it has previously been resolved.The only time the
peerIdentity
promise is replaced is when identity validation fails and there is no a target peer identity. So what happen in other permutations of promise fulfillment/rejection? e.g.:The text was updated successfully, but these errors were encountered: