From ce9f3e7a1b72bea02da3cd4755f6c5c1c8c794e3 Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Sat, 17 Apr 2021 21:29:14 +0700 Subject: [PATCH] Removed extra init method for context --- src/bc/model.rs | 17 +---------------- src/bc_protocol/connection.rs | 3 +-- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/bc/model.rs b/src/bc/model.rs index f4e2ff0..ec0f966 100644 --- a/src/bc/model.rs +++ b/src/bc/model.rs @@ -130,23 +130,8 @@ impl Bc { } } -impl Default for BcContext { - fn default() -> BcContext { - Self::new() - } -} - impl BcContext { - pub fn new() -> BcContext { - BcContext { - in_bin_mode: HashSet::new(), - encryption_protocol: Arc::new(Mutex::new(EncryptionProtocol::Unencrypted)), - } - } - - pub fn new_with_encryption_protocol( - encryption_protocol: Arc>, - ) -> BcContext { + pub fn new(encryption_protocol: Arc>) -> BcContext { BcContext { in_bin_mode: HashSet::new(), encryption_protocol, diff --git a/src/bc_protocol/connection.rs b/src/bc_protocol/connection.rs index cc783c9..44c30a2 100644 --- a/src/bc_protocol/connection.rs +++ b/src/bc_protocol/connection.rs @@ -60,8 +60,7 @@ impl BcConnection { let encryption_protocol = Arc::new(Mutex::new(EncryptionProtocol::Unencrypted)); let connections_encryption_protocol = encryption_protocol.clone(); let rx_thread = std::thread::spawn(move || { - let mut context = - BcContext::new_with_encryption_protocol(connections_encryption_protocol); + let mut context = BcContext::new(connections_encryption_protocol); let mut result; while { result = BcConnection::poll(&mut context, &conn, &mut subs);