Removed extra init method for context

This commit is contained in:
QuantumEntangledAndy committed 2021-04-17 21:29:14 +07:00
1 parent eda598c40f
commit ce9f3e7a1b
2 files changed
+2 -18

No files matched your search

+1 -16
View File
@@ -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<Mutex<EncryptionProtocol>>,
) -> BcContext {
pub fn new(encryption_protocol: Arc<Mutex<EncryptionProtocol>>) -> BcContext {
BcContext {
in_bin_mode: HashSet::new(),
encryption_protocol,
+1 -2
View File
@@ -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);