ws: refactor, bug fixes, improvements (#155)

- split swarm worker into two modules
- split socket worker into two modules
- keep track of which offers peers have sent and only allow matching
answers
- always clean up after closing connection
- use channel for telling connections to close
- move some logic into new ConnectionRunner struct
- use slotmap for connection reference storage
- fix double counting of error responses
- actually close connections that take too long to send responses to
- remove announced_info_hashes entry on AnnounceEvent::Stopped
This commit is contained in:
Joakim Frostegård 2023-11-09 18:06:21 +01:00 committed by GitHub
parent af9d5a55f6
commit fe5ccf6646
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 1770 additions and 1583 deletions

View file

@ -154,6 +154,8 @@ pub struct CleaningConfig {
pub torrent_cleaning_interval: u64,
/// Remove peers that have not announced for this long (seconds)
pub max_peer_age: u32,
/// Require that offers are answered to withing this period (seconds)
pub max_offer_age: u32,
// Clean connections this often (seconds)
pub connection_cleaning_interval: u64,
/// Close connections if no responses have been sent to them for this long (seconds)
@ -169,8 +171,9 @@ impl Default for CleaningConfig {
fn default() -> Self {
Self {
torrent_cleaning_interval: 30,
max_peer_age: 1800,
max_connection_idle: 60 * 5,
max_peer_age: 180,
max_offer_age: 120,
max_connection_idle: 180,
connection_cleaning_interval: 30,
close_after_tls_update_grace_period: 60 * 60 * 60,
}