fix: poll_read: wrong behavior on half close #362
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 #360.
修改
process_flags
以前会在内部将LocalClosing
和Reset
状态转换到Closed
,阻止poll_read
观测Closed
的来源,现在将状态保留了,drop
部分对应Reset
的检查也有更新。check_self_state
现在返回一个Result<Option<Result>>
,表示存在不需要读底层的流就能向用户返回数据的情况(根据约定,对EOF返回一个零长度的读)。shutdown
后,另一方向的流也会出现问题,所以放宽了poll_read
,poll_write
等几个函数中的一些flag检查,现在可以在shutdown
之后继续调用read
读取数据了。