mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-25 04:35:17 +00:00
Simplify state inspection
This commit is contained in:
committed by
Dirkjan Ochtman
parent
4b2909ac1a
commit
08996a3676
@@ -309,21 +309,19 @@ impl<'a> Chunks<'a> {
|
||||
!drop || matches!(state, ChunksState::Finalized),
|
||||
"finalize must be called before drop"
|
||||
);
|
||||
let mut should_transmit = match state {
|
||||
ChunksState::Readable(mut rs) => {
|
||||
let (_, max_stream_data) = rs.max_stream_data(self.streams.stream_receive_window);
|
||||
self.pending
|
||||
.post_read(self.id, ShouldTransmit(false), max_stream_data, false);
|
||||
self.streams.recv.insert(self.id, rs);
|
||||
max_stream_data.0
|
||||
}
|
||||
ChunksState::Finished => false,
|
||||
ChunksState::Reset(_) => true,
|
||||
ChunksState::Finalized => {
|
||||
// Noop on repeated calls
|
||||
return ShouldTransmit(false);
|
||||
}
|
||||
};
|
||||
if let ChunksState::Finalized = state {
|
||||
// Noop on repeated calls
|
||||
return ShouldTransmit(false);
|
||||
}
|
||||
|
||||
let mut should_transmit = matches!(state, ChunksState::Reset(_));
|
||||
if let ChunksState::Readable(mut rs) = state {
|
||||
let (_, max_stream_data) = rs.max_stream_data(self.streams.stream_receive_window);
|
||||
self.pending
|
||||
.post_read(self.id, ShouldTransmit(false), max_stream_data, false);
|
||||
self.streams.recv.insert(self.id, rs);
|
||||
should_transmit |= max_stream_data.0
|
||||
}
|
||||
|
||||
// Issue connection-level flow control credit for any data we read regardless of state
|
||||
let max_data = self.streams.add_read_credits(self.read);
|
||||
|
||||
Reference in New Issue
Block a user