mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 10:45:30 +00:00
aquatic: add and use NetworkConfig.peer_announce_interval
This commit is contained in:
parent
ca9d15c7a9
commit
7239e9c047
2 changed files with 3 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ pub struct Config {
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct NetworkConfig {
|
pub struct NetworkConfig {
|
||||||
pub address: SocketAddr,
|
pub address: SocketAddr,
|
||||||
|
pub peer_announce_interval: i32,
|
||||||
pub recv_buffer_size: usize,
|
pub recv_buffer_size: usize,
|
||||||
pub poll_event_capacity: usize,
|
pub poll_event_capacity: usize,
|
||||||
}
|
}
|
||||||
|
|
@ -52,6 +53,7 @@ impl Default for NetworkConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
address: SocketAddr::from(([127, 0, 0, 1], 3000)),
|
address: SocketAddr::from(([127, 0, 0, 1], 3000)),
|
||||||
|
peer_announce_interval: 60 * 15,
|
||||||
poll_event_capacity: 4096,
|
poll_event_capacity: 4096,
|
||||||
recv_buffer_size: 4096 * 128,
|
recv_buffer_size: 4096 * 128,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ pub fn handle_announce_requests(
|
||||||
|
|
||||||
let response = Response::Announce(AnnounceResponse {
|
let response = Response::Announce(AnnounceResponse {
|
||||||
transaction_id: request.transaction_id,
|
transaction_id: request.transaction_id,
|
||||||
announce_interval: AnnounceInterval(600), // FIXME
|
announce_interval: AnnounceInterval(config.network.peer_announce_interval), // FIXME
|
||||||
leechers: NumberOfPeers(torrent_data.num_leechers.load(Ordering::SeqCst) as i32),
|
leechers: NumberOfPeers(torrent_data.num_leechers.load(Ordering::SeqCst) as i32),
|
||||||
seeders: NumberOfPeers(torrent_data.num_seeders.load(Ordering::SeqCst) as i32),
|
seeders: NumberOfPeers(torrent_data.num_seeders.load(Ordering::SeqCst) as i32),
|
||||||
peers: response_peers
|
peers: response_peers
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue