mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 18:55:32 +00:00
udp: add optional peers per torrent statistics
This commit is contained in:
parent
c0ed0eb7db
commit
f0e0a84088
9 changed files with 251 additions and 17 deletions
|
|
@ -41,6 +41,8 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
|
|||
let mut response_senders = Vec::new();
|
||||
let mut response_receivers = BTreeMap::new();
|
||||
|
||||
let (statistics_sender, statistics_receiver) = unbounded();
|
||||
|
||||
let server_start_instant = ServerStartInstant::new();
|
||||
|
||||
for i in 0..config.swarm_workers {
|
||||
|
|
@ -71,6 +73,7 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
|
|||
let state = state.clone();
|
||||
let request_receiver = request_receivers.remove(&i).unwrap().clone();
|
||||
let response_sender = ConnectedResponseSender::new(response_senders.clone());
|
||||
let statistics_sender = statistics_sender.clone();
|
||||
|
||||
Builder::new()
|
||||
.name(format!("swarm-{:02}", i + 1))
|
||||
|
|
@ -90,6 +93,7 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
|
|||
server_start_instant,
|
||||
request_receiver,
|
||||
response_sender,
|
||||
statistics_sender,
|
||||
SwarmWorkerIndex(i),
|
||||
)
|
||||
})
|
||||
|
|
@ -148,7 +152,12 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
|
|||
WorkerIndex::Util,
|
||||
);
|
||||
|
||||
workers::statistics::run_statistics_worker(sentinel, config, state);
|
||||
workers::statistics::run_statistics_worker(
|
||||
sentinel,
|
||||
config,
|
||||
state,
|
||||
statistics_receiver,
|
||||
);
|
||||
})
|
||||
.with_context(|| "spawn statistics worker")?;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue