diff --git a/src/client.rs b/src/client.rs index 5d0d9b3..ae7c448 100644 --- a/src/client.rs +++ b/src/client.rs @@ -108,10 +108,10 @@ pub async fn play( let total = records.len() * repeat as usize; let connect_to = connect_to.to_socket_addrs().unwrap().next().unwrap(); - let dummy_bytes: &'static _ = Box::leak(Box::new(vec![0x42u8; 16 * 1024 * 1024])); + let dummy_bytes: &'static _ = Box::leak(vec![0x42u8; 16 * 1024 * 1024].into_boxed_slice()); let notify_socket = notify_addr.map(|notify_addr| { - let socket = std::net::UdpSocket::bind("0.0.0.0:48567").unwrap(); + let socket = std::net::UdpSocket::bind("0.0.0.0:8091").unwrap(); socket.connect(notify_addr).unwrap(); let socket: &'static _ = Box::leak(Box::new(socket)); socket @@ -196,7 +196,6 @@ pub async fn play( let mut handles = Vec::new(); for (conn_id, (server_name, records)) in records.iter() { let connector = TlsConnector::from(config.clone()); - let dummy_bytes = dummy_bytes.clone(); handles.push(tokio::spawn(async move { let mut running_guard = running.lock().await; running_guard.insert(*conn_id); @@ -272,7 +271,7 @@ pub async fn play( } drop(limiter); if let Some(notify_socket) = ¬ify_socket { - notify_socket.send(&cnt.to_be_bytes()).unwrap(); + notify_socket.send(&cnt.to_be_bytes()).ok(); } let mut running_guard = running.lock().await; running_guard.remove(conn_id); @@ -289,7 +288,6 @@ pub async fn play( for _i in 0..repeat { let mut handles = Vec::new(); for (conn_id, (_server_name, records)) in records.iter() { - let dummy_bytes = dummy_bytes.clone(); handles.push(tokio::spawn(async move { let mut running_guard = running.lock().await; running_guard.insert(*conn_id); @@ -358,7 +356,7 @@ pub async fn play( } drop(limiter); if let Some(notify_socket) = notify_socket { - notify_socket.send(&cnt.to_be_bytes()).unwrap(); + notify_socket.send(&cnt.to_be_bytes()).ok(); } let mut running_guard = running.lock().await; running_guard.remove(conn_id); @@ -375,6 +373,6 @@ pub async fn play( println!("Unfinished: {:?}", running.lock().await); if let Some(notify_socket) = notify_socket { - notify_socket.send(&[0xff; 4]).unwrap(); + notify_socket.send(&[0xff; 4]).ok(); } }