Skip to content

Commit

Permalink
fix: linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Aug 12, 2024
1 parent f5e38bb commit 6a707b9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 45 deletions.
71 changes: 34 additions & 37 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,56 +66,53 @@ pub async fn start(config: &Configuration, tracker: Arc<core::Tracker>) -> Vec<J
}

// Start the UDP blocks
match &config.udp_trackers {
Some(udp_trackers) => {
for udp_tracker_config in udp_trackers {
if tracker.is_private() {
warn!(
"Could not start UDP tracker on: {} while in private mode. UDP is not safe for private trackers!",
udp_tracker_config.bind_address
);
} else {
jobs.push(udp_tracker::start_job(udp_tracker_config, tracker.clone(), registar.give_form()).await);
}
if let Some(udp_trackers) = &config.udp_trackers {
for udp_tracker_config in udp_trackers {
if tracker.is_private() {
warn!(

Check warning on line 72 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L69-L72

Added lines #L69 - L72 were not covered by tests
"Could not start UDP tracker on: {} while in private mode. UDP is not safe for private trackers!",
udp_tracker_config.bind_address
);
} else {
jobs.push(udp_tracker::start_job(udp_tracker_config, tracker.clone(), registar.give_form()).await);

Check warning on line 77 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L77

Added line #L77 was not covered by tests
}
}
None => info!("No UDP blocks in configuration"),
} else {
info!("No UDP blocks in configuration");

Check warning on line 81 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L81

Added line #L81 was not covered by tests
}

// Start the HTTP blocks
match &config.http_trackers {
Some(http_trackers) => {
for http_tracker_config in http_trackers {
if let Some(job) = http_tracker::start_job(
http_tracker_config,
tracker.clone(),
registar.give_form(),
servers::http::Version::V1,
)
.await
{
jobs.push(job);
};
}
}
None => info!("No HTTP blocks in configuration"),
}

// Start HTTP API
match &config.http_api {
Some(http_api_config) => {
if let Some(job) = tracker_apis::start_job(
http_api_config,
if let Some(http_trackers) = &config.http_trackers {
for http_tracker_config in http_trackers {
if let Some(job) = http_tracker::start_job(

Check warning on line 87 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L85-L87

Added lines #L85 - L87 were not covered by tests
http_tracker_config,
tracker.clone(),
registar.give_form(),
servers::apis::Version::V1,
servers::http::Version::V1,
)
.await
{
jobs.push(job);
};
}
None => info!("No API block in configuration"),
} else {
info!("No HTTP blocks in configuration");

Check warning on line 99 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L99

Added line #L99 was not covered by tests
}

// Start HTTP API
if let Some(http_api_config) = &config.http_api {
if let Some(job) = tracker_apis::start_job(

Check warning on line 104 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L103-L104

Added lines #L103 - L104 were not covered by tests
http_api_config,
tracker.clone(),
registar.give_form(),

Check warning on line 107 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L106-L107

Added lines #L106 - L107 were not covered by tests
servers::apis::Version::V1,
)
.await

Check warning on line 110 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L110

Added line #L110 was not covered by tests
{
jobs.push(job);
};

Check warning on line 113 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L112-L113

Added lines #L112 - L113 were not covered by tests
} else {
info!("No API block in configuration");

Check warning on line 115 in src/app.rs

View check run for this annotation

Codecov / codecov/patch

src/app.rs#L115

Added line #L115 was not covered by tests
}

// Start runners to remove torrents without peers, every interval
Expand Down
13 changes: 5 additions & 8 deletions src/console/ci/e2e/tracker_container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,11 @@ impl TrackerContainer {
///
/// Will panic if it can't remove the container.
pub fn remove(&self) {
match &self.running {
Some(_running_container) => {
error!("Can't remove running container: {} ...", self.name);
}
None => {
info!("Removing docker tracker container: {} ...", self.name);
Docker::remove(&self.name).expect("Container should be removed");
}
if let Some(_running_container) = &self.running {
error!("Can't remove running container: {} ...", self.name);

Check warning on line 109 in src/console/ci/e2e/tracker_container.rs

View check run for this annotation

Codecov / codecov/patch

src/console/ci/e2e/tracker_container.rs#L108-L109

Added lines #L108 - L109 were not covered by tests
} else {
info!("Removing docker tracker container: {} ...", self.name);
Docker::remove(&self.name).expect("Container should be removed");

Check warning on line 112 in src/console/ci/e2e/tracker_container.rs

View check run for this annotation

Codecov / codecov/patch

src/console/ci/e2e/tracker_container.rs#L111-L112

Added lines #L111 - L112 were not covered by tests
}
}

Expand Down

0 comments on commit 6a707b9

Please sign in to comment.