Skip to content

Commit

Permalink
extension: fixup ExtensionContents serialization
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Gautier <[email protected]>
  • Loading branch information
baloo committed Feb 3, 2024
1 parent 4ca0f43 commit a333f18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/proto/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ impl<'a, W: io::Write> ser::Serializer for &'a mut Serializer<W> {
}

fn serialize_str(self, v: &str) -> ProtoResult<()> {
(v.len() as u32).serialize(&mut *self)?;
self.serialize_bytes(v.as_bytes())
}

fn serialize_bytes(self, v: &[u8]) -> ProtoResult<()> {
(v.len() as u32).serialize(&mut *self)?;
self.writer.write_all(v).map_err(Into::into)
}

Expand Down
2 changes: 2 additions & 0 deletions src/proto/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,6 @@ fn test_extension() {
];
let extension: Extension = from_bytes(extension_bytes).unwrap();
assert_eq!(extension.extension_type, "[email protected]");
let out = to_bytes(&extension).unwrap();
assert_eq!(extension_bytes, out);
}

0 comments on commit a333f18

Please sign in to comment.