Skip to content

Commit

Permalink
Increase [rntimatcher] ring buffer size
Browse files Browse the repository at this point in the history
* Set [rntimatcher] ring buffer size to 10 instead of 5
  -> optimization for traffic pattern D
* Add re-try [download] after 2sec timeout
  • Loading branch information
bastian-src committed Jul 28, 2024
1 parent 802e2a6 commit b218c07
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/logic/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ use crate::{
util::{determine_process_id, init_heap_buffer, print_debug, print_info, sockopt_get_tcp_info},
};

pub const INITIAL_SLEEP_TIME_MS: u64 = 20000;
pub const INITIAL_SLEEP_TIME_MS: u64 = 20_000;
pub const READILY_WAITING_SLEEP_TIME_MS: u64 = 500;
pub const DOWNLOADING_IDLE_SLEEP_TIME_MS: u64 = 20;
pub const RECOVERY_SLEEP_TIME_MS: u64 = 2000;
pub const BETWEEN_DOWNLOADS_SLEEP_TIME_MS: u64 = 1000;
pub const RECOVERY_SLEEP_TIME_MS: u64 = 2_000;
pub const BETWEEN_DOWNLOADS_SLEEP_TIME_MS: u64 = 1_000;
pub const RESTART_TIMEOUT_US: u64 = 2_000_000;

pub const TCP_STREAM_READ_BUFFER_SIZE: usize = 100000;
pub const TCP_STREAM_READ_BUFFER_SIZE: usize = 100_000;

#[derive(Clone, Debug, PartialEq, Default)]
pub struct DownloadStreamState {
Expand Down Expand Up @@ -378,6 +379,13 @@ fn handle_downloading(params: DownloadingParameters) -> DownloaderState {
}
}
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
// If no packets have arrived in a certain time, restart the download
if timedata.is_empty() {
let now_us = chrono::Local::now().timestamp_micros() as u64;
if (now_us - *start_timestamp_us) > RESTART_TIMEOUT_US {
return DownloaderState::ErrorStartingDownload("Downloading Timeout!".to_string())
}
}
DownloaderState::Downloading
}
Err(ref e) if e.kind() == io::ErrorKind::ConnectionReset => {
Expand Down
2 changes: 1 addition & 1 deletion src/logic/rnti_matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub const BASIC_FILTER_MIN_TOTAL_UL_FACTOR: f64 = 0.005;
pub const BASIC_FILTER_MAX_UL_PER_DCI: u64 = 5_000_000;
pub const BASIC_FILTER_MIN_OCCURENCES_FACTOR: f64 = 0.05;

pub const RNTI_RING_BUFFER_SIZE: usize = 5;
pub const RNTI_RING_BUFFER_SIZE: usize = 10;

pub const METRIC_HEADER_LENGTH: usize = 5;
pub const METRIC_INITIAL_INDEX_START: usize = 0;
Expand Down

0 comments on commit b218c07

Please sign in to comment.