Skip to content

Commit

Permalink
address code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Neto committed Oct 26, 2023
1 parent 5ecb025 commit e52d51f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ impl Connection {
"PATH_CHALLENGE queued without 1-RTT keys"
);

if buf.capacity() < self.path.current_mtu() as usize {
if (buf.capacity() - buf.len()) < self.path.current_mtu() as usize {
buf.reserve(self.path.current_mtu() as usize - buf.capacity());
}

Expand Down Expand Up @@ -916,7 +916,7 @@ impl Connection {
None
},
segment_size: match num_datagrams {
1 | 0 => None,
1 => None,
_ => Some(self.path.current_mtu() as usize),
},
src_ip: self.local_ip,
Expand Down
4 changes: 3 additions & 1 deletion quinn/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,9 @@ impl State {
let mut transmits = 0;

let max_datagrams = self.socket.max_transmit_segments();
let mut buffer = BytesMut::with_capacity(1500);
let capacity = 1500;
let mut buffer = BytesMut::with_capacity(capacity);

while let Some(t) = self.inner.poll_transmit(now, max_datagrams, &mut buffer) {
transmits += match t.segment_size {
None => 1,
Expand Down

0 comments on commit e52d51f

Please sign in to comment.