Skip to content

Commit

Permalink
proto: Use match for grease with reserved version
Browse files Browse the repository at this point in the history
Reduces LOC.
  • Loading branch information
gretchenfrage committed Dec 25, 2024
1 parent e053882 commit fa27532
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions quinn-proto/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,10 @@ impl Endpoint {
}
.encode(buf);
// Grease with a reserved version
if version != 0x0a1a_2a3a {
buf.write::<u32>(0x0a1a_2a3a);
} else {
buf.write::<u32>(0x0a1a_2a4a);
}
buf.write::<u32>(match version {
0x0a1a_2a3a => 0x0a1a_2a4a,
_ => 0x0a1a_2a3a,
});
for &version in &self.config.supported_versions {
buf.write(version);
}
Expand Down

0 comments on commit fa27532

Please sign in to comment.