Repository navigation
feat: 未完成帧超时 IncompleteFrameTimeoutMs - #41
Merged
Merged
Conversation
- 新选项:帧已开头但后续字节连续 N ms 未到达即判定会话失效、断线重连;默认 0 = 关闭 - 计时在解码循环侧:仅当缓冲有未消费字节(半帧进行中)时给 ReadAsync 挂独立 超时令牌(不链会话取消,遵守解码器生命周期约定);缓冲为空不计时、新字节 到达即重置、整帧切尽归零——与 ReceiveIdleTimeoutMs(完全静默也计时)互补 - FrameError 新类别 IncompleteFrameTimeout,携带 8KB 上限保护的缓冲快照 - 测试:真实 TCP 回环 9 用例覆盖 issue 清单(静默不触发/半头超时/半正文超时/ 续传重置/整帧后空闲不触发/连续超时幂等/快照截断/构造校验/超时中 Dispose) - README 双语区分两种接收超时的适用场景;CHANGELOG Unreleased 记录
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #38
语义
新增
StreamConnectionOptions.IncompleteFrameTimeoutMs(默认 0 = 关闭,纯增量):FrameError新类别IncompleteFrameTimeout,携带受 8KB 上限保护的缓冲快照(与 IncompleteFrameOverflow 快照同一上限常量)。实现要点
ReadAsync前,仅当上轮 AdvanceTo 后缓冲非空且选项开启时,挂一个独立的超时令牌——令牌刻意不链会话取消(遵守 FrameDecoder 生命周期约定二),只有超时会触发它;超时后以 SessionFault 收尾、不再复用该 PipeReader,因此不存在"进行中的读取残留到下一次读取"(issue 特别强调的点)。IsCanceled结果返回时同样按超时处理(闩锁路径),OCE 路径与 IsCanceled 路径都有覆盖。ReceiveIdleTimeoutMs完全独立、互不影响;MaxIncompleteFrameBufferBytes(字节防线)与它(时间防线)互补,README 已明确区分。测试(真实 TCP 回环,9 用例 × net8.0/net10.0/net48 全过)
对应 issue 测试清单:从未收到字节不触发 / 只有部分长度头超时并结束会话 / 完整头半正文超时 / 期限内续传重置并最终交付 / 整帧后长空闲不触发 / 连续两轮超时重连幂等(迟到故障不误杀新会话)/ 快照 8KB 截断 / 超时重连中 Dispose 干净停机 / 负值构造即抛。
验收标准核对
ReceiveIdleTimeoutMs的区别在公共文档明确说明(XML 注释 + README 双语"未完成帧防护"与"活性探测"两节)