mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
udp: remove pending scrape config stuff, adjust io uring code
This commit is contained in:
parent
71a3cb9a5a
commit
6d784c25e9
2 changed files with 1 additions and 32 deletions
|
|
@ -210,28 +210,18 @@ impl Default for StatisticsConfig {
|
||||||
pub struct CleaningConfig {
|
pub struct CleaningConfig {
|
||||||
/// Clean torrents this often (seconds)
|
/// Clean torrents this often (seconds)
|
||||||
pub torrent_cleaning_interval: u64,
|
pub torrent_cleaning_interval: u64,
|
||||||
/// Clean pending scrape responses this often (seconds)
|
|
||||||
///
|
|
||||||
/// In regular operation, there should be no pending scrape responses
|
|
||||||
/// lingering for long enough to have to be cleaned up this way.
|
|
||||||
pub pending_scrape_cleaning_interval: u64,
|
|
||||||
/// Allow clients to use a connection token for this long (seconds)
|
/// Allow clients to use a connection token for this long (seconds)
|
||||||
pub max_connection_age: u32,
|
pub max_connection_age: u32,
|
||||||
/// Remove peers who have not announced for this long (seconds)
|
/// Remove peers who have not announced for this long (seconds)
|
||||||
pub max_peer_age: u32,
|
pub max_peer_age: u32,
|
||||||
/// Remove pending scrape responses that have not been returned from swarm
|
|
||||||
/// workers for this long (seconds)
|
|
||||||
pub max_pending_scrape_age: u32,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for CleaningConfig {
|
impl Default for CleaningConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
torrent_cleaning_interval: 60 * 2,
|
torrent_cleaning_interval: 60 * 2,
|
||||||
pending_scrape_cleaning_interval: 60 * 10,
|
|
||||||
max_connection_age: 60 * 2,
|
max_connection_age: 60 * 2,
|
||||||
max_peer_age: 60 * 20,
|
max_peer_age: 60 * 20,
|
||||||
max_pending_scrape_age: 60,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ const RESPONSE_BUF_LEN: usize = 2048;
|
||||||
|
|
||||||
const USER_DATA_RECV: u64 = u64::MAX;
|
const USER_DATA_RECV: u64 = u64::MAX;
|
||||||
const USER_DATA_PULSE_TIMEOUT: u64 = u64::MAX - 1;
|
const USER_DATA_PULSE_TIMEOUT: u64 = u64::MAX - 1;
|
||||||
const USER_DATA_CLEANING_TIMEOUT: u64 = u64::MAX - 2;
|
|
||||||
|
|
||||||
const SOCKET_IDENTIFIER: Fixed = Fixed(0);
|
const SOCKET_IDENTIFIER: Fixed = Fixed(0);
|
||||||
|
|
||||||
|
|
@ -90,7 +89,6 @@ pub struct SocketWorker {
|
||||||
resubmittable_sqe_buf: Vec<io_uring::squeue::Entry>,
|
resubmittable_sqe_buf: Vec<io_uring::squeue::Entry>,
|
||||||
recv_sqe: io_uring::squeue::Entry,
|
recv_sqe: io_uring::squeue::Entry,
|
||||||
pulse_timeout_sqe: io_uring::squeue::Entry,
|
pulse_timeout_sqe: io_uring::squeue::Entry,
|
||||||
cleaning_timeout_sqe: io_uring::squeue::Entry,
|
|
||||||
peer_valid_until: ValidUntil,
|
peer_valid_until: ValidUntil,
|
||||||
rng: SmallRng,
|
rng: SmallRng,
|
||||||
}
|
}
|
||||||
|
|
@ -147,21 +145,7 @@ impl SocketWorker {
|
||||||
.user_data(USER_DATA_PULSE_TIMEOUT)
|
.user_data(USER_DATA_PULSE_TIMEOUT)
|
||||||
};
|
};
|
||||||
|
|
||||||
let cleaning_timeout_sqe = {
|
let resubmittable_sqe_buf = vec![recv_sqe.clone(), pulse_timeout_sqe.clone()];
|
||||||
let timespec_ptr = Box::into_raw(Box::new(
|
|
||||||
Timespec::new().sec(config.cleaning.pending_scrape_cleaning_interval),
|
|
||||||
)) as *const _;
|
|
||||||
|
|
||||||
Timeout::new(timespec_ptr)
|
|
||||||
.build()
|
|
||||||
.user_data(USER_DATA_CLEANING_TIMEOUT)
|
|
||||||
};
|
|
||||||
|
|
||||||
let resubmittable_sqe_buf = vec![
|
|
||||||
recv_sqe.clone(),
|
|
||||||
pulse_timeout_sqe.clone(),
|
|
||||||
cleaning_timeout_sqe.clone(),
|
|
||||||
];
|
|
||||||
|
|
||||||
let peer_valid_until = ValidUntil::new(
|
let peer_valid_until = ValidUntil::new(
|
||||||
shared_state.server_start_instant,
|
shared_state.server_start_instant,
|
||||||
|
|
@ -181,7 +165,6 @@ impl SocketWorker {
|
||||||
buf_ring,
|
buf_ring,
|
||||||
recv_sqe,
|
recv_sqe,
|
||||||
pulse_timeout_sqe,
|
pulse_timeout_sqe,
|
||||||
cleaning_timeout_sqe,
|
|
||||||
resubmittable_sqe_buf,
|
resubmittable_sqe_buf,
|
||||||
socket,
|
socket,
|
||||||
peer_valid_until,
|
peer_valid_until,
|
||||||
|
|
@ -263,10 +246,6 @@ impl SocketWorker {
|
||||||
self.resubmittable_sqe_buf
|
self.resubmittable_sqe_buf
|
||||||
.push(self.pulse_timeout_sqe.clone());
|
.push(self.pulse_timeout_sqe.clone());
|
||||||
}
|
}
|
||||||
USER_DATA_CLEANING_TIMEOUT => {
|
|
||||||
self.resubmittable_sqe_buf
|
|
||||||
.push(self.cleaning_timeout_sqe.clone());
|
|
||||||
}
|
|
||||||
send_buffer_index => {
|
send_buffer_index => {
|
||||||
let result = cqe.result();
|
let result = cqe.result();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue