mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 18:55:32 +00:00
ws: fix metric update in handle_announce_request
This commit is contained in:
parent
3cfe044297
commit
f87e649e60
1 changed files with 12 additions and 6 deletions
|
|
@ -385,14 +385,20 @@ fn handle_announce_request(
|
||||||
PeerStatus::Stopped => torrent_data.peers.remove(&request.peer_id),
|
PeerStatus::Stopped => torrent_data.peers.remove(&request.peer_id),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(removed_peer) = opt_removed_peer {
|
if let Some(&Peer { seeder: true, .. }) = opt_removed_peer.as_ref() {
|
||||||
if removed_peer.seeder {
|
|
||||||
torrent_data.num_seeders -= 1;
|
torrent_data.num_seeders -= 1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
#[cfg(feature = "metrics")]
|
#[cfg(feature = "metrics")]
|
||||||
|
match peer_status {
|
||||||
|
PeerStatus::Stopped if opt_removed_peer.is_some() => {
|
||||||
|
::metrics::decrement_gauge!("aquatic_peers", 1.0, "ip_version" => ip_version);
|
||||||
|
}
|
||||||
|
PeerStatus::Leeching | PeerStatus::Seeding if opt_removed_peer.is_none() => {
|
||||||
::metrics::increment_gauge!("aquatic_peers", 1.0, "ip_version" => ip_version);
|
::metrics::increment_gauge!("aquatic_peers", 1.0, "ip_version" => ip_version);
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If peer sent offers, send them on to random peers
|
// If peer sent offers, send them on to random peers
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue