switched to crrossbeam_channel from mpsc
This commit is contained in:
parent
8238edc3f6
commit
335f9e7f59
3 changed files with 6 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
|||
use std::{sync::mpsc, time::Duration};
|
||||
use crossbeam_channel::unbounded;
|
||||
|
||||
use modules::{socket_handler::Socket, stream_states::stream_states_class::StreamState, message_handler::{MessageHandler, StateMessage}};
|
||||
use workctl::sync_flag;
|
||||
|
@ -16,7 +17,7 @@ fn main() {
|
|||
let mut state = StreamState::new();
|
||||
|
||||
let socket_listener = Socket::make_listener(SERVER_ADDRESS);
|
||||
let (from_socket_tx, from_socket_rx) = mpsc::channel::<String>();
|
||||
let (from_socket_tx, from_socket_rx) = unbounded::<String>();
|
||||
let (mut listener_can_run_flag, listener_join_handle) = Socket::handle_connections(socket_listener, from_socket_tx);
|
||||
|
||||
let (control_c_flag_tx, control_c_called_flag_rx) = sync_flag::new_syncflag(false);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use workctl::sync_flag;
|
||||
use std::net::{TcpListener, TcpStream, Shutdown};
|
||||
use std::io::{Read, Write};
|
||||
use std::sync::mpsc::Sender;
|
||||
use crossbeam_channel::Sender;
|
||||
use std::thread::{self, JoinHandle};
|
||||
use std::time::Duration;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use std::sync::mpsc;
|
||||
use crossbeam_channel::unbounded;
|
||||
use std::io::{Write};
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
@ -31,7 +32,7 @@ fn panic_no_listener() {
|
|||
#[test]
|
||||
fn can_handle_messages() {
|
||||
let listener = Socket::make_listener("localhost:5004");
|
||||
let (tx_1, rx_1) = mpsc::channel::<String>();
|
||||
let (tx_1, rx_1) = unbounded::<String>();
|
||||
|
||||
let (mut flag, connection_handle) = Socket::handle_connections(listener, tx_1);
|
||||
|
||||
|
@ -52,7 +53,7 @@ fn can_handle_messages() {
|
|||
#[test]
|
||||
fn can_handle_delayed_messages() {
|
||||
let listener = Socket::make_listener("localhost:5005");
|
||||
let (tx_1, rx_1) = mpsc::channel::<String>();
|
||||
let (tx_1, rx_1) = unbounded::<String>();
|
||||
|
||||
let (mut flag, connection_handle) = Socket::handle_connections(listener, tx_1);
|
||||
|
||||
|
|
Loading…
Reference in a new issue