Prepare for releasing 8.1.0

This commit is contained in:
Igor Katson 2025-06-05 11:38:50 +01:00
parent 3fa55bdc14
commit 28332fd4b9
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
21 changed files with 1387 additions and 978 deletions

View file

@ -42,12 +42,12 @@ disable-upload = []
[dependencies]
# sqlx and home are pinned so that we can compile on older Rusts
sqlx = { version = "=0.8.2", features = [
sqlx = { version = "0.8", features = [
"runtime-tokio",
"macros",
"postgres",
], default-features = false, optional = true }
home = { version = "=0.5.5", optional = true }
home = { version = "0.5", optional = true }
bencode = { path = "../bencode", default-features = false, package = "librqbit-bencode", version = "3" }
tracker_comms = { path = "../tracker_comms", default-features = false, package = "librqbit-tracker-comms", version = "2.1" }
@ -66,7 +66,7 @@ tokio = { version = "1", features = [
"fs",
"io-util",
] }
governor = "0.8"
governor = "0.10"
console-subscriber = { version = "0.4", optional = true }
axum = { version = "0.8", optional = true }
tower-http = { version = "0.6", features = ["cors", "trace"], optional = true }
@ -85,12 +85,12 @@ reqwest = { version = "0.12", default-features = false, features = [
] }
urlencoding = "2"
byteorder = "1"
bincode = "1"
bincode = "2"
bitvec = "1"
parking_lot = "0.12"
tracing = "0.1.40"
size_format = "1"
rand = "0.8"
rand = "0.9"
tracing-subscriber = { version = "0.3", default-features = false, features = [
"json",
"fmt",
@ -112,12 +112,12 @@ bytes = "1.5.0"
rlimit = "0.10.1"
async-stream = "0.3.5"
memmap2 = { version = "0.9.4" }
lru = { version = "0.12.3", optional = true }
lru = { version = "0.14", optional = true }
mime_guess = { version = "2.0.5", default-features = false }
tokio-socks = "0.5.2"
async-trait = "0.1.81"
async-backtrace = { version = "0.2", optional = true }
notify = { version = "7", optional = true }
notify = { version = "8", optional = true }
walkdir = "2.5.0"
arc-swap = "1.7.1"
intervaltree = "0.2.7"
@ -127,8 +127,6 @@ async-compression = { version = "0.4.18", features = ["tokio", "gzip"] }
anyhow = "1"
[dev-dependencies]
futures = { version = "0.3" }
tracing-subscriber = "0.3"
tokio-test = "0.4"
tempfile = "3"
rand = { version = "0.8", features = ["small_rng"] }

View file

@ -47,11 +47,7 @@ impl Blocklist {
anyhow::bail!("Failed to fetch blocklist: HTTP {}", response.status());
}
let reader = StreamReader::new(
response
.bytes_stream()
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e)),
);
let reader = StreamReader::new(response.bytes_stream().map_err(std::io::Error::other));
Self::create_from_stream(reader).await
}

View file

@ -13,6 +13,7 @@ use crate::{
use librqbit_core::hash_id::Id20;
#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub enum ReadMetainfoResult<Rx> {
Found {
info: TorrentMetaV1Info<ByteBufOwned>,

View file

@ -358,17 +358,17 @@ impl<H: PeerConnectionHandler> PeerConnection<H> {
use crate::tests::test_util::TestPeerMetadata;
let tpm = TestPeerMetadata::from_peer_id(self.peer_id);
use rand::Rng;
if rand::thread_rng().gen_bool(tpm.disconnect_probability()) {
if rand::rng().random_bool(tpm.disconnect_probability()) {
bail!("disconnecting, to simulate failure in tests");
}
#[allow(clippy::cast_possible_truncation)]
let sleep_ms = (rand::thread_rng().gen::<f64>()
let sleep_ms = (rand::rng().random::<f64>()
* (tpm.max_random_sleep_ms as f64))
as u64;
tokio::time::sleep(Duration::from_millis(sleep_ms)).await;
if rand::thread_rng().gen_bool(tpm.bad_data_probability()) {
if rand::rng().random_bool(tpm.bad_data_probability()) {
warn!("will NOT actually read the data to simulate a malicious peer that sends garbage");
write_buf.fill(0);
skip_reading_for_e2e_tests = true;

View file

@ -998,11 +998,8 @@ impl Session {
return Ok(None);
}
fn check_valid(pb: &PathBuf) -> anyhow::Result<()> {
if pb.components().into_iter().any(|x| match x {
Component::Normal(_) => false,
_ => true,
}) {
fn check_valid(pb: &Path) -> anyhow::Result<()> {
if pb.components().any(|x| !matches!(x, Component::Normal(_))) {
bail!("path traversal in torrent name detected")
}
Ok(())

View file

@ -87,7 +87,7 @@ async fn _test_e2e_download(drop_checks: &DropChecks) {
async move {
let peer_id = TestPeerMetadata {
server_id: i,
max_random_sleep_ms: rand::thread_rng().gen_range(0u8..16),
max_random_sleep_ms: rand::rng().random_range(0u8..16),
}
.as_peer_id();
let listen_range_start = 15100u16 + i as u16;

View file

@ -8,7 +8,7 @@ use std::{
use anyhow::bail;
use librqbit_core::Id20;
use parking_lot::RwLock;
use rand::{thread_rng, Rng, RngCore, SeedableRng};
use rand::{rng, Rng, RngCore, SeedableRng};
use tempfile::TempDir;
use tracing::{info, trace};
@ -29,7 +29,7 @@ pub fn create_new_file_with_random_content(path: &Path, mut size: usize) {
trace!(?path, "creating temp file");
const BUF_SIZE: usize = 8192 * 16;
let mut rng = rand::rngs::SmallRng::from_entropy();
let mut rng = rand::rngs::SmallRng::from_os_rng();
let mut write_buf = [0; BUF_SIZE];
while size > 0 {
rng.fill_bytes(&mut write_buf[..]);
@ -67,7 +67,7 @@ impl TestPeerMetadata {
pub fn as_peer_id(&self) -> Id20 {
let mut peer_id = Id20::default();
thread_rng().fill(&mut peer_id.0);
rng().fill(&mut peer_id.0);
peer_id.0[0] = self.server_id;
peer_id.0[1] = self.max_random_sleep_ms;
peer_id

View file

@ -127,10 +127,10 @@ impl TorrentStateInitializing {
// For all the remaining pieces we claim we have, validate them with decreasing probability.
let mut queue = queue.iter_ones().collect_vec();
queue.shuffle(&mut rand::thread_rng());
queue.shuffle(&mut rand::rng());
for (tmp_id, piece_id) in queue.into_iter().enumerate() {
let denom: u32 = (tmp_id + 1).min(50).try_into().unwrap();
if rand::thread_rng().gen_ratio(1, denom) {
if rand::rng().random_ratio(1, denom) {
to_validate.set(piece_id, true);
}
}

View file

@ -94,7 +94,7 @@ impl TorrentStreams {
// Shuffle to decrease determinism and make queueing fairer.
use rand::seq::SliceRandom;
all.shuffle(&mut rand::thread_rng());
all.shuffle(&mut rand::rng());
Interleave { all: all.into() }
}