fix a couple of partial read/write bugs #11981
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes and adds test coverage for a couple of bugs involving component model streams:
delay returning
Droppeduntil producer buffer drainedIf the
StreamProducercallsDestination::set_buffer, we need to make sure all the items in that buffer have been delivered to the receiver (or the receiver closes its end) before telling it the write end has been dropped.reset read/write state back to
Openon event deliveryIf one end of a stream does a partial read or write, we leave the other end in a
GuestReadystate, allowing further reads or writes to proceed until the buffer has been drained or filled, respectively. However, once we've delivered the event regarding the partial operation, we need to set the state back toOpen, since we'll have released the buffer back to the guest at that point.