From bd14aa1dc2162e68c3a90027e3ca4e6404aea94d Mon Sep 17 00:00:00 2001 From: Matthias Einwag Date: Sat, 31 Oct 2020 19:17:07 -0700 Subject: [PATCH] Update add_read_credits parameter name to transmit_max_stream_data It wasn't super clear what `more` means here. The purpose of this parameter is to signal whether a `MAX_STREAM_DATA` frame needs to be sent. This change tries to improve that. --- quinn-proto/src/connection/mod.rs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/quinn-proto/src/connection/mod.rs b/quinn-proto/src/connection/mod.rs index 036c12f1f..323e1fdfb 100644 --- a/quinn-proto/src/connection/mod.rs +++ b/quinn-proto/src/connection/mod.rs @@ -814,18 +814,24 @@ where /// /// The return value if `Ok` contains the bytes and their offset in the stream. pub fn read_unordered(&mut self, id: StreamId) -> Result, ReadError> { - Ok(self.streams.read_unordered(id)?.map(|(buf, offset, more)| { - self.add_read_credits(id, more); - (buf, offset) - })) + Ok(self + .streams + .read_unordered(id)? + .map(|(buf, offset, transmit_max_stream_data)| { + self.add_read_credits(id, transmit_max_stream_data); + (buf, offset) + })) } /// Read from the given recv stream pub fn read(&mut self, id: StreamId, buf: &mut [u8]) -> Result, ReadError> { - Ok(self.streams.read(id, buf)?.map(|(len, more)| { - self.add_read_credits(id, more); - len - })) + Ok(self + .streams + .read(id, buf)? + .map(|(len, transmit_max_stream_data)| { + self.add_read_credits(id, transmit_max_stream_data); + len + })) } /// Send data on the given stream @@ -2778,10 +2784,10 @@ where self.streams.alloc_remote_stream(&self.peer_params, dir); } - fn add_read_credits(&mut self, id: StreamId, more: bool) { + fn add_read_credits(&mut self, id: StreamId, transmit_max_stream_data: bool) { let space = &mut self.spaces[SpaceId::Data]; space.pending.max_data = true; - if more { + if transmit_max_stream_data { // Only bother issuing stream credit if the peer wants to send more space.pending.max_stream_data.insert(id); }