mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
Run cargo clippy --fix and cargo fmt
This commit is contained in:
parent
22e151d0f0
commit
5401eaf85f
28 changed files with 94 additions and 107 deletions
|
|
@ -57,12 +57,12 @@ pub struct OutMessageMeta {
|
|||
pub pending_scrape_id: Option<PendingScrapeId>,
|
||||
}
|
||||
|
||||
impl Into<OutMessageMeta> for InMessageMeta {
|
||||
fn into(self) -> OutMessageMeta {
|
||||
impl From<InMessageMeta> for OutMessageMeta {
|
||||
fn from(val: InMessageMeta) -> Self {
|
||||
OutMessageMeta {
|
||||
out_message_consumer_id: self.out_message_consumer_id,
|
||||
connection_id: self.connection_id,
|
||||
pending_scrape_id: self.pending_scrape_id,
|
||||
out_message_consumer_id: val.out_message_consumer_id,
|
||||
connection_id: val.connection_id,
|
||||
pending_scrape_id: val.pending_scrape_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ impl ConnectionRunner {
|
|||
clean_up_data.before_open();
|
||||
|
||||
let config = self.config.clone();
|
||||
let connection_id = self.connection_id.clone();
|
||||
let connection_id = self.connection_id;
|
||||
|
||||
race(
|
||||
async {
|
||||
|
|
@ -608,7 +608,7 @@ impl ConnectionCleanupData {
|
|||
let mut announced_info_hashes = HashMap::new();
|
||||
|
||||
for (info_hash, peer_id) in self.announced_info_hashes.take().into_iter() {
|
||||
let consumer_index = calculate_in_message_consumer_index(&config, info_hash);
|
||||
let consumer_index = calculate_in_message_consumer_index(config, info_hash);
|
||||
|
||||
announced_info_hashes
|
||||
.entry(consumer_index)
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ async fn handle_request_stream<S>(
|
|||
match in_message {
|
||||
InMessage::AnnounceRequest(request) => {
|
||||
torrents.borrow_mut().handle_announce_request(
|
||||
&config,
|
||||
config,
|
||||
&mut rng.borrow_mut(),
|
||||
&mut out_messages,
|
||||
server_start_instant,
|
||||
|
|
@ -150,7 +150,7 @@ async fn handle_request_stream<S>(
|
|||
}
|
||||
InMessage::ScrapeRequest(request) => torrents
|
||||
.borrow_mut()
|
||||
.handle_scrape_request(&config, &mut out_messages, meta, request),
|
||||
.handle_scrape_request(config, &mut out_messages, meta, request),
|
||||
};
|
||||
|
||||
for (meta, out_message) in out_messages {
|
||||
|
|
|
|||
|
|
@ -248,7 +248,11 @@ impl TorrentMaps {
|
|||
regarding_offer_id: offer_id,
|
||||
};
|
||||
|
||||
if let Some(_) = answer_receiver.expecting_answers.remove(&expecting_answer) {
|
||||
if answer_receiver
|
||||
.expecting_answers
|
||||
.remove(&expecting_answer)
|
||||
.is_some()
|
||||
{
|
||||
let answer_out_message = AnswerOutMessage {
|
||||
action: AnnounceAction::Announce,
|
||||
peer_id: request.peer_id,
|
||||
|
|
@ -426,13 +430,11 @@ impl TorrentMaps {
|
|||
#[cfg(feature = "metrics")]
|
||||
self.peers_gauge_ipv4.decrement(1.0);
|
||||
}
|
||||
} else {
|
||||
if let Some(torrent_data) = self.ipv6.get_mut(&info_hash) {
|
||||
torrent_data.remove_peer(peer_id);
|
||||
} else if let Some(torrent_data) = self.ipv6.get_mut(&info_hash) {
|
||||
torrent_data.remove_peer(peer_id);
|
||||
|
||||
#[cfg(feature = "metrics")]
|
||||
self.peers_gauge_ipv6.decrement(1.0);
|
||||
}
|
||||
#[cfg(feature = "metrics")]
|
||||
self.peers_gauge_ipv6.decrement(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue