Skip to content

Commit 4d2983b

Browse files
authored
refactor(noise): modify message framing
Resolves #4488. Pull-Request: #4548.
1 parent 51dd702 commit 4d2983b

File tree

6 files changed

+249
-424
lines changed

6 files changed

+249
-424
lines changed

Cargo.lock

Lines changed: 26 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

transports/noise/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ license = "MIT"
99
repository = "https://github.com/libp2p/rust-libp2p"
1010

1111
[dependencies]
12+
asynchronous-codec = "0.7"
1213
bytes = "1"
1314
curve25519-dalek = "4.1.1"
1415
futures = "0.3.28"

transports/noise/src/io.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
2323
mod framed;
2424
pub(crate) mod handshake;
25+
use asynchronous_codec::Framed;
2526
use bytes::Bytes;
26-
use framed::{NoiseFramed, MAX_FRAME_LEN};
27+
use framed::{Codec, MAX_FRAME_LEN};
2728
use futures::prelude::*;
2829
use futures::ready;
2930
use log::trace;
@@ -38,7 +39,7 @@ use std::{
3839
///
3940
/// `T` is the type of the underlying I/O resource.
4041
pub struct Output<T> {
41-
io: NoiseFramed<T, snow::TransportState>,
42+
io: Framed<T, Codec<snow::TransportState>>,
4243
recv_buffer: Bytes,
4344
recv_offset: usize,
4445
send_buffer: Vec<u8>,
@@ -47,12 +48,12 @@ pub struct Output<T> {
4748

4849
impl<T> fmt::Debug for Output<T> {
4950
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
50-
f.debug_struct("NoiseOutput").field("io", &self.io).finish()
51+
f.debug_struct("NoiseOutput").finish()
5152
}
5253
}
5354

5455
impl<T> Output<T> {
55-
fn new(io: NoiseFramed<T, snow::TransportState>) -> Self {
56+
fn new(io: Framed<T, Codec<snow::TransportState>>) -> Self {
5657
Output {
5758
io,
5859
recv_buffer: Bytes::new(),

0 commit comments

Comments
 (0)