This commit is contained in:
2025-11-11 21:20:03 +01:00
parent 936111e3c6
commit d831179783
4 changed files with 385 additions and 46 deletions
+4 -2
View File
@@ -1,4 +1,5 @@
use std::{
convert::TryInto,
path::{Path, PathBuf},
sync::Arc,
};
@@ -150,7 +151,7 @@ async fn stream_file_bytes(
let remote_addr = maybe_addr!(tx.connection().remote_addr());
let game_file = base_dir.join(relative_path);
tracing::debug!(
"{remote_addr} streaming file bytes for peer: {:?}, offset: {offset}, length: {:?}",
"{remote_addr} streaming file bytes for peer: {:?}, offset: {offset}, length: {length:?}",
game_file
);
@@ -166,7 +167,8 @@ async fn stream_file_bytes(
let mut buf = vec![0u8; 64 * 1024];
while remaining > 0 {
let read_len = std::cmp::min(remaining, buf.len() as u64) as usize;
let read_len = std::cmp::min(remaining, buf.len() as u64);
let read_len: usize = read_len.try_into().unwrap_or(usize::MAX);
if read_len == 0 {
break;
}