Clean up dead code.
This commit is contained in:
@ -1,8 +1,4 @@
|
||||
use crate::{
|
||||
field::Field,
|
||||
queue::{Message, MsgType, Queue},
|
||||
utils::GenID,
|
||||
};
|
||||
use crate::queue::{Message, MsgType, Queue};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::{
|
||||
@ -40,7 +36,7 @@ impl ClientChannel {
|
||||
}
|
||||
let (tx, rx) = channel();
|
||||
reg.insert(msg.get_id(), tx);
|
||||
self.queue.send(msg);
|
||||
self.queue.send(msg).unwrap();
|
||||
rx
|
||||
}
|
||||
|
||||
@ -60,17 +56,6 @@ mod client_channels {
|
||||
|
||||
static TIMEOUT: Duration = Duration::from_millis(500);
|
||||
|
||||
#[test]
|
||||
fn request_new_message() {
|
||||
let queue = Queue::new();
|
||||
let chan = ClientChannel::new(queue);
|
||||
let msg_types = [MsgType::Document, MsgType::Time];
|
||||
for msg_type in msg_types.iter() {
|
||||
let msg = Message::new(msg_type.clone());
|
||||
assert_eq!(msg.get_msg_type(), msg_type);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fowards_message() {
|
||||
let msg_type = MsgType::Document;
|
||||
@ -122,15 +107,13 @@ mod client_channels {
|
||||
|
||||
pub struct Client {
|
||||
channel: ClientChannel,
|
||||
queue: Queue,
|
||||
rx: Receiver<Message>,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
fn new(chan: ClientChannel, queue: Queue, rx: Receiver<Message>) -> Self {
|
||||
fn new(chan: ClientChannel, rx: Receiver<Message>) -> Self {
|
||||
Self {
|
||||
channel: chan,
|
||||
queue: queue,
|
||||
rx: rx,
|
||||
}
|
||||
}
|
||||
@ -139,7 +122,7 @@ impl Client {
|
||||
let (tx, rx) = channel();
|
||||
queue.add(tx.clone(), RESPONS_TO.to_vec());
|
||||
let chan = ClientChannel::new(queue.clone());
|
||||
let client = Client::new(chan.clone(), queue, rx);
|
||||
let client = Client::new(chan.clone(), rx);
|
||||
spawn(move || {
|
||||
client.listen();
|
||||
});
|
||||
@ -171,7 +154,7 @@ mod clients {
|
||||
let chan_rx = chan.send(Message::new(MsgType::SessionValidate));
|
||||
let msg = queue_rx.recv_timeout(TIMEOUT).unwrap();
|
||||
let expected = create_validated_reply(msg);
|
||||
queue.send(expected.clone());
|
||||
queue.send(expected.clone()).unwrap();
|
||||
let result = chan_rx.recv_timeout(TIMEOUT).unwrap();
|
||||
assert_eq!(result.get_id(), expected.get_id());
|
||||
assert_eq!(result.get_msg_type(), expected.get_msg_type());
|
||||
|
Reference in New Issue
Block a user