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

Settling Promises when receiving FIN bit #18

Closed
shampson opened this issue Jun 4, 2018 · 0 comments
Closed

Settling Promises when receiving FIN bit #18

shampson opened this issue Jun 4, 2018 · 0 comments
Labels
PR exists A pull request has been submitted

Comments

@shampson
Copy link
Collaborator

shampson commented Jun 4, 2018

As previously discussed, the spec doesn't have anything for waitForReadable promises being rejected when a FIN bit is received for the QUIC stream. At this point we know there will be no more incoming data and know if the Promise can't be fulfilled.

Changes I'll make in a PR:

  • remove "Promises won't be rejected" from waitForReadable & waitForWritable
  • Update waitForReadable & waitForWritable to mention that promises will be rejected if [[Readable/Writable]] transitions from true to false
  • Add to waitForReadable - on receiving/reading a FIN bit, any unsettled promises will be rejected if they can't be fulfilled with the amount of data buffered in the QUIC stream

One question is whether to resolve or reject the Promise when receiving the FIN bit. Here's the problems I see doing it either way:

  1. Resolving the promise
  • It isn't really being resolved because the amount available to be read is smaller than asked with waitForReadable. A solution to this could be resolving the promise with the amount available as opposed to undefined in other cases.
  1. Rejecting the promise:
  • When the promise gets rejected [[Readable]] can be either true or false. In some cases you want to read the remaining data even though the promise is getting rejected.
shampson pushed a commit to shampson/webrtc-quic that referenced this issue Jun 4, 2018
@aboba aboba added the PR exists A pull request has been submitted label Jun 7, 2018
@aboba aboba closed this as completed Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR exists A pull request has been submitted
Projects
None yet
Development

No branches or pull requests

2 participants