Commit 2e92fe4
Fix chunk drop in incremental reader by buffering pending chunks
ReadIncrementalInstructionBase<T> previously stored each incoming chunk
in a single _latestChunk field. When several ChunkReceived FFI events
were dispatched on the same sync-context flush (routine between Unity
frames), OnChunk overwrote the field before the consumer coroutine
could resume from its yield, silently dropping earlier chunks.
Queue chunks that arrive while a prior read is still pending. Reset()
advances _latestChunk to the next queued chunk and keeps
IsCurrentReadDone true so the next yield completes immediately, draining
the buffer before waiting for more FFI events.
Flips DataStreamIncrementalReadTests from failing to passing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 77f7fd5 commit 2e92fe4
2 files changed
Lines changed: 22 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
110 | | - | |
111 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
112 | 131 | | |
113 | 132 | | |
114 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | | - | |
| 8 | + | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
0 commit comments