Run rustfmt

This commit is contained in:
Joakim Frostegård 2021-10-16 17:49:00 +02:00
parent 523a21dac4
commit 3678e86654
7 changed files with 27 additions and 22 deletions

View file

@ -94,7 +94,11 @@ impl TorrentMaps {
Self::clean_torrent_map(config, access_list, &mut self.ipv6);
}
fn clean_torrent_map(config: &Config, access_list: &Arc<AccessList>, torrent_map: &mut TorrentMap) {
fn clean_torrent_map(
config: &Config,
access_list: &Arc<AccessList>,
torrent_map: &mut TorrentMap,
) {
let now = Instant::now();
torrent_map.retain(|info_hash, torrent_data| {

View file

@ -122,7 +122,7 @@ pub fn run_poll_loop(
&mut poll,
local_responses.drain(..),
&out_message_receiver,
&mut connections
&mut connections,
);
}
@ -219,7 +219,11 @@ pub fn run_handshakes_and_read_messages(
debug!("read message");
match InMessage::from_ws_message(ws_message) {
Ok(InMessage::AnnounceRequest(ref request)) if !state.access_list.allows(access_list_mode, &request.info_hash.0) => {
Ok(InMessage::AnnounceRequest(ref request))
if !state
.access_list
.allows(access_list_mode, &request.info_hash.0) =>
{
let out_message = OutMessage::ErrorResponse(ErrorResponse {
failure_reason: "Info hash not allowed".into(),
action: Some(ErrorResponseAction::Announce),
@ -227,7 +231,7 @@ pub fn run_handshakes_and_read_messages(
});
local_responses.push((meta, out_message));
},
}
Ok(in_message) => {
if let Err(err) = in_message_sender.send((meta, in_message)) {
error!("InMessageSender: couldn't send message: {:?}", err);

View file

@ -7,10 +7,7 @@ use crate::config::Config;
pub fn update_access_list(config: &Config, state: &State) {
match config.access_list.mode {
AccessListMode::Require | AccessListMode::Forbid => {
if let Err(err) = state
.access_list
.update_from_path(&config.access_list.path)
{
if let Err(err) = state.access_list.update_from_path(&config.access_list.path) {
::log::error!("Couldn't update access list: {:?}", err);
}
}