From b649a1d86fe6b42a7021769b24f76ef5e15bf62c Mon Sep 17 00:00:00 2001 From: Neel Chauhan Date: Sun, 18 Dec 2022 21:00:24 -0800 Subject: [PATCH 1/2] msg::{CreateFast/CreatedFast}: Rename accessor to (into_)body() --- crates/tor-cell/src/chancell/msg.rs | 4 ++-- crates/tor-cell/tests/testvec_chanmsg.rs | 4 ++-- crates/tor-proto/src/circuit.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/tor-cell/src/chancell/msg.rs b/crates/tor-cell/src/chancell/msg.rs index b4cfe821d..756fc38e1 100644 --- a/crates/tor-cell/src/chancell/msg.rs +++ b/crates/tor-cell/src/chancell/msg.rs @@ -302,7 +302,7 @@ fixed_len_handshake! { } impl CreateFast { /// Return the content of this handshake - pub fn body(&self) -> &[u8] { + pub fn handshake(&self) -> &[u8] { &self.handshake } } @@ -315,7 +315,7 @@ fixed_len_handshake! { } impl CreatedFast { /// Consume this message and return the content of this handshake - pub fn into_body(self) -> Vec { + pub fn into_handshake(self) -> Vec { self.handshake } } diff --git a/crates/tor-cell/tests/testvec_chanmsg.rs b/crates/tor-cell/tests/testvec_chanmsg.rs index f05c39775..d2794e704 100644 --- a/crates/tor-cell/tests/testvec_chanmsg.rs +++ b/crates/tor-cell/tests/testvec_chanmsg.rs @@ -186,7 +186,7 @@ fn test_create_fast() { fbody(cmd, body, &msg::CreateFast::new(handshake.clone()).into()); let create_fast = msg::CreateFast::new(handshake.clone()); - assert_eq!(create_fast.body(), &handshake[..]); + assert_eq!(create_fast.handshake(), &handshake[..]); } #[test] @@ -221,7 +221,7 @@ fn test_created_fast() { fbody(cmd, body, &msg::CreatedFast::new(handshake.clone()).into()); let created_fast = msg::CreatedFast::new(handshake.clone()); - assert_eq!(created_fast.into_body(), handshake); + assert_eq!(created_fast.into_handshake(), handshake); } #[test] diff --git a/crates/tor-proto/src/circuit.rs b/crates/tor-proto/src/circuit.rs index 0c05cc5b1..29e6df963 100644 --- a/crates/tor-proto/src/circuit.rs +++ b/crates/tor-proto/src/circuit.rs @@ -592,7 +592,7 @@ impl CreateHandshakeWrap for CreateFastWrap { fn decode_chanmsg(&self, msg: CreateResponse) -> Result> { use CreateResponse::*; match msg { - CreatedFast(m) => Ok(m.into_body()), + CreatedFast(m) => Ok(m.into_handshake()), Destroy(_) => Err(Error::CircRefused( "Relay replied to CREATE_FAST with DESTROY.", )), @@ -769,7 +769,7 @@ mod test { ChanMsg::CreateFast(cf) => cf, _ => panic!(), }; - let (_, rep) = CreateFastServer::server(&mut rng, &[()], cf.body()).unwrap(); + let (_, rep) = CreateFastServer::server(&mut rng, &[()], cf.handshake()).unwrap(); CreateResponse::CreatedFast(CreatedFast::new(rep)) } else { let c2 = match create_cell.msg() { From e39e39ea27da135ef4d723d68832c6387cb68461 Mon Sep 17 00:00:00 2001 From: Neel Chauhan Date: Mon, 19 Dec 2022 08:25:15 -0800 Subject: [PATCH 2/2] Add semver.md for (into_)handshake() --- crates/tor-proto/semver.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 crates/tor-proto/semver.md diff --git a/crates/tor-proto/semver.md b/crates/tor-proto/semver.md new file mode 100644 index 000000000..d937a48d6 --- /dev/null +++ b/crates/tor-proto/semver.md @@ -0,0 +1,2 @@ +BREAKING: Deprecated CreateFast::body(), CreatedFast::into_body() methods +MODIFIED: Added CreateFast::handshake(), CreatedFast::into_handshake() methods