Skip to content

Commit 0a9def2

Browse files
committed
Try fixing broadcast speed
1 parent 08b0b1f commit 0a9def2

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

pixie-server/src/udp.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ async fn broadcast_chunks(
4949
queue.remove(&hash);
5050
Some(hash)
5151
}
52-
None => rx.recv().await,
52+
None => {
53+
let hash = rx.recv().await;
54+
wait_for = wait_for.max(Instant::now());
55+
hash
56+
}
5357
}
5458
};
5559

@@ -90,7 +94,6 @@ async fn broadcast_chunks(
9094
.for_each(|(a, b)| *b ^= a);
9195
write_buf[34..34 + len].clone_from_slice(body);
9296

93-
wait_for = wait_for.max(Instant::now());
9497
time::sleep_until(wait_for).await;
9598

9699
let sent_len = socket.send_to(&write_buf[..34 + len], chunks_addr).await?;
@@ -103,7 +106,6 @@ async fn broadcast_chunks(
103106
let len = BODY_LEN;
104107
write_buf[34..34 + len].clone_from_slice(body);
105108

106-
wait_for = wait_for.max(Instant::now());
107109
time::sleep_until(wait_for).await;
108110
let sent_len = socket.send_to(&write_buf[..34 + len], chunks_addr).await?;
109111
ensure!(sent_len == 34 + len, "Could not send packet");

0 commit comments

Comments
 (0)