Handle overlapping stream receive chunks
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
This commit is contained in:
+6
-40
@@ -8124,48 +8124,14 @@ fn accept_stream_data(
|
||||
stream_recv_pending: &mut HashMap<u64, BTreeMap<u64, Vec<u8>>>,
|
||||
data: StreamData,
|
||||
) -> (Vec<Vec<u8>>, usize, u64) {
|
||||
let stream_id = data.stream_id;
|
||||
let expected = stream_next_recv_offset.entry(stream_id).or_insert(0);
|
||||
if !dosh::transport::stream_data_within_receive_window(
|
||||
*expected,
|
||||
dosh::transport::accept_stream_data_chunks(
|
||||
stream_next_recv_offset,
|
||||
stream_recv_pending,
|
||||
data.stream_id,
|
||||
data.offset,
|
||||
data.bytes.len(),
|
||||
data.bytes,
|
||||
STREAM_INITIAL_WINDOW,
|
||||
) {
|
||||
return (Vec::new(), 0, *expected);
|
||||
}
|
||||
if data.offset < *expected {
|
||||
return (Vec::new(), 0, *expected);
|
||||
}
|
||||
if data.offset > *expected {
|
||||
stream_recv_pending
|
||||
.entry(stream_id)
|
||||
.or_default()
|
||||
.entry(data.offset)
|
||||
.or_insert(data.bytes);
|
||||
return (Vec::new(), 0, *expected);
|
||||
}
|
||||
|
||||
let mut writes = vec![data.bytes];
|
||||
let mut consumed = writes[0].len();
|
||||
*expected = expected.saturating_add(consumed as u64);
|
||||
|
||||
while let Some(bytes) = stream_recv_pending
|
||||
.entry(stream_id)
|
||||
.or_default()
|
||||
.remove(expected)
|
||||
{
|
||||
consumed = consumed.saturating_add(bytes.len());
|
||||
*expected = expected.saturating_add(bytes.len() as u64);
|
||||
writes.push(bytes);
|
||||
}
|
||||
if stream_recv_pending
|
||||
.get(&stream_id)
|
||||
.is_some_and(BTreeMap::is_empty)
|
||||
{
|
||||
stream_recv_pending.remove(&stream_id);
|
||||
}
|
||||
(writes, consumed, *expected)
|
||||
)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
||||
Reference in New Issue
Block a user