mirror of
https://github.com/n0-computer/noq.git
synced 2026-10-03 12:40:46 +00:00
quinn-proto: check for stopped assembler before reading data
I'm guessing these were missed when these new methods were added, and it seems like they do present a bit of a layering violation.
This commit is contained in:
committed by
Benjamin Saunders
parent
7947ad5854
commit
f2d01fb2ad
@@ -95,6 +95,10 @@ impl Recv {
|
||||
}
|
||||
|
||||
pub(super) fn read_chunk(&mut self, max_length: usize) -> StreamReadResult<Bytes> {
|
||||
if self.assembler.is_stopped() {
|
||||
return Err(ReadError::UnknownStream);
|
||||
}
|
||||
|
||||
match self.assembler.read(max_length)? {
|
||||
Some(bytes) => Ok(Some(bytes)),
|
||||
None => self.read_blocked().map(|()| None),
|
||||
@@ -105,6 +109,10 @@ impl Recv {
|
||||
&mut self,
|
||||
chunks: &mut [Bytes],
|
||||
) -> Result<Option<ReadChunks>, ReadError> {
|
||||
if self.assembler.is_stopped() {
|
||||
return Err(ReadError::UnknownStream);
|
||||
}
|
||||
|
||||
let mut out = ReadChunks { bufs: 0, read: 0 };
|
||||
if chunks.is_empty() {
|
||||
return Ok(Some(out));
|
||||
|
||||
Reference in New Issue
Block a user