Commit acd91df
committed
fix(streaming): decouple stream ctx timeout from per-recv timeout to fix ttstream connection reuse
Previously, RecvMsg created a child context from the stream ctx for recv timeout.
This coupled stream-level timeout with per-recv timeout, causing incorrect behavior:
- When DisableCancelRemote=true, stream ctx expiration was misidentified as recv timeout,
preventing the RST frame from being sent and breaking connection reuse.
- When stream ctx expired before recv timeout, the error was reported as recv timeout
instead of stream timeout.
Changes:
- Redesign Pipe to support two-level ctx: a pipe-level ctx (stream lifecycle) and a
per-read ctx (individual recv timeout), each with its own callback
- Separate stream timeout (error 12015) from recv timeout (error 12014) so they trigger
independent close/cancel logic
- Fix Pipe.ReadCtx to drain remaining items after detecting closed state, preventing
data loss in Write+Close race
- Move container package to internal to prevent external dependency1 parent 89f0337 commit acd91df
28 files changed
Lines changed: 990 additions & 457 deletions
File tree
- pkg
- remote/trans/ttstream
- container
- internal/container
- streaming
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
| |||
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| 95 | + | |
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
| |||
File renamed without changes.
0 commit comments