Skip to content

Commit

Permalink
build(deps): update rand requirement in /tools/xdp (#2474)
Browse files Browse the repository at this point in the history
Co-authored-by: Boquan Fang <[email protected]>
  • Loading branch information
boquan-fang and Boquan Fang authored Feb 15, 2025
1 parent d7b2c87 commit 00e3371
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tools/xdp/s2n-quic-xdp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tokio = { version = "1", features = ["net"], optional = true }
bolero = "0.12"
futures = "0.3"
pin-project-lite = "0.2"
rand = "0.8"
rand = "0.9"
s2n-quic-core = { path = "../../../quic/s2n-quic-core", features = ["testing"] }
tokio = { version = "1", features = ["full"] }

Expand Down
6 changes: 3 additions & 3 deletions tools/xdp/s2n-quic-xdp/src/io/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::{
};
use crate::{if_xdp::RingFlags, ring, umem::Umem};
use core::{mem::size_of, time::Duration};
use rand::prelude::*;
use rand::Rng;
use s2n_quic_core::{
inet::ExplicitCongestionNotification,
io::{
Expand Down Expand Up @@ -131,7 +131,7 @@ async fn send(count: u32, outputs: Vec<tx::Channel<atomic_waker::Handle>>, umem:

tx.queue(|queue| {
let max = queue.capacity().min((count - counter) as usize);
let count = thread_rng().gen_range(0..=max);
let count = rand::rng().random_range(0..=max);
trace!("max: {max}, count: {count}");

for _ in 0..count {
Expand Down Expand Up @@ -182,7 +182,7 @@ async fn recv(packets: u32, inputs: Vec<rx::Channel<atomic_waker::Handle>>, umem

/// Randomly yields to other tasks
async fn maybe_yield() {
if thread_rng().gen() {
if rand::rng().random() {
trace!("yielding");
tokio::task::yield_now().await;
}
Expand Down

0 comments on commit 00e3371

Please sign in to comment.