Allow notify to fail
This commit is contained in:
parent
46e85e6ee8
commit
65ae0717bf
1 changed files with 5 additions and 7 deletions
|
|
@ -108,10 +108,10 @@ pub async fn play(
|
||||||
let total = records.len() * repeat as usize;
|
let total = records.len() * repeat as usize;
|
||||||
let connect_to = connect_to.to_socket_addrs().unwrap().next().unwrap();
|
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 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();
|
socket.connect(notify_addr).unwrap();
|
||||||
let socket: &'static _ = Box::leak(Box::new(socket));
|
let socket: &'static _ = Box::leak(Box::new(socket));
|
||||||
socket
|
socket
|
||||||
|
|
@ -196,7 +196,6 @@ pub async fn play(
|
||||||
let mut handles = Vec::new();
|
let mut handles = Vec::new();
|
||||||
for (conn_id, (server_name, records)) in records.iter() {
|
for (conn_id, (server_name, records)) in records.iter() {
|
||||||
let connector = TlsConnector::from(config.clone());
|
let connector = TlsConnector::from(config.clone());
|
||||||
let dummy_bytes = dummy_bytes.clone();
|
|
||||||
handles.push(tokio::spawn(async move {
|
handles.push(tokio::spawn(async move {
|
||||||
let mut running_guard = running.lock().await;
|
let mut running_guard = running.lock().await;
|
||||||
running_guard.insert(*conn_id);
|
running_guard.insert(*conn_id);
|
||||||
|
|
@ -272,7 +271,7 @@ pub async fn play(
|
||||||
}
|
}
|
||||||
drop(limiter);
|
drop(limiter);
|
||||||
if let Some(notify_socket) = ¬ify_socket {
|
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;
|
let mut running_guard = running.lock().await;
|
||||||
running_guard.remove(conn_id);
|
running_guard.remove(conn_id);
|
||||||
|
|
@ -289,7 +288,6 @@ pub async fn play(
|
||||||
for _i in 0..repeat {
|
for _i in 0..repeat {
|
||||||
let mut handles = Vec::new();
|
let mut handles = Vec::new();
|
||||||
for (conn_id, (_server_name, records)) in records.iter() {
|
for (conn_id, (_server_name, records)) in records.iter() {
|
||||||
let dummy_bytes = dummy_bytes.clone();
|
|
||||||
handles.push(tokio::spawn(async move {
|
handles.push(tokio::spawn(async move {
|
||||||
let mut running_guard = running.lock().await;
|
let mut running_guard = running.lock().await;
|
||||||
running_guard.insert(*conn_id);
|
running_guard.insert(*conn_id);
|
||||||
|
|
@ -358,7 +356,7 @@ pub async fn play(
|
||||||
}
|
}
|
||||||
drop(limiter);
|
drop(limiter);
|
||||||
if let Some(notify_socket) = notify_socket {
|
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;
|
let mut running_guard = running.lock().await;
|
||||||
running_guard.remove(conn_id);
|
running_guard.remove(conn_id);
|
||||||
|
|
@ -375,6 +373,6 @@ pub async fn play(
|
||||||
println!("Unfinished: {:?}", running.lock().await);
|
println!("Unfinished: {:?}", running.lock().await);
|
||||||
|
|
||||||
if let Some(notify_socket) = notify_socket {
|
if let Some(notify_socket) = notify_socket {
|
||||||
notify_socket.send(&[0xff; 4]).unwrap();
|
notify_socket.send(&[0xff; 4]).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue