mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 10:15:31 +00:00
WIP: aquatic_ws: add half-crappy load test, fix infinite loop bug
This commit is contained in:
parent
c7be84a61e
commit
a5108f813d
17 changed files with 821 additions and 10 deletions
41
aquatic_ws_load_test/src/common.rs
Normal file
41
aquatic_ws_load_test/src/common.rs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
use std::sync::{Arc, atomic::AtomicUsize};
|
||||
|
||||
use rand_distr::Pareto;
|
||||
|
||||
pub use aquatic_ws_protocol::*;
|
||||
|
||||
|
||||
#[derive(PartialEq, Eq, Clone)]
|
||||
pub struct TorrentPeer {
|
||||
pub info_hash: InfoHash,
|
||||
pub scrape_hash_indeces: Vec<usize>,
|
||||
pub peer_id: PeerId,
|
||||
pub port: u16,
|
||||
}
|
||||
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Statistics {
|
||||
pub requests: AtomicUsize,
|
||||
pub response_peers: AtomicUsize,
|
||||
pub responses_announce: AtomicUsize,
|
||||
pub responses_scrape: AtomicUsize,
|
||||
pub responses_failure: AtomicUsize,
|
||||
pub bytes_sent: AtomicUsize,
|
||||
pub bytes_received: AtomicUsize,
|
||||
}
|
||||
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct LoadTestState {
|
||||
pub info_hashes: Arc<Vec<InfoHash>>,
|
||||
pub statistics: Arc<Statistics>,
|
||||
pub pareto: Arc<Pareto<f64>>,
|
||||
}
|
||||
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
pub enum RequestType {
|
||||
Announce,
|
||||
Scrape
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue