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

Sender.setTransport a promise due to async issues? #598

Closed
robin-raymond opened this issue Sep 9, 2016 · 2 comments
Closed

Sender.setTransport a promise due to async issues? #598

robin-raymond opened this issue Sep 9, 2016 · 2 comments

Comments

@robin-raymond
Copy link
Contributor

It's possible that the transport passed into sender.setTransport dies just moments before the setTransport is called unknown to the app developer (e.g. DTLS asynchronously failed to negotiate). Thus the setTransport would throw an exception because the passed in transport is dead. The programmer would NOT have received the transport state change and thus would be unaware anything went wrong in advance and could not substitute an alternative transport before the promise is fulfilled upon receiving the state change event (and thus disregard any setTransport exceptions due to failed states that are not relevant).

@robin-raymond
Copy link
Contributor Author

Resolved.

@ShijunS
Copy link

ShijunS commented Sep 10, 2016

sender.setTransport should not have dependency on the state of the transport, which is expected to change dynamically. We should not expect setTransport to throw exception, therefore there is no need to change the call to promise-based. It should be kept consistent with the sender constructor logic.

The (proposed) promise could make the app more complicated if there are two places to handle the transport.state. Handling the transport object with the transport.onstatechange should be sufficient.

@aboba aboba reopened this Sep 11, 2016
@aboba aboba added the 1.1 label Oct 25, 2016
@aboba aboba closed this as completed Oct 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants