Skip to content

Commit

Permalink
refactor: simplify download slot logic
Browse files Browse the repository at this point in the history
More easier to understand.
  • Loading branch information
Roardom committed Dec 8, 2024
1 parent 6367f8c commit e36eb94
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/announce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,15 @@ pub async fn announce(
}

// Make sure user isn't leeching more torrents than their group allows
let has_hit_download_slot_limit = queries.left > 0
&& matches!(group.download_slots, Some(slots) if slots <= user.num_leeching);
let has_hit_download_slot_limit = if queries.left > 0 {
if let Some(slots) = group.download_slots {
user.num_leeching >= slots
} else {
false
}
} else {
false
};

// Change of upload/download compared to previous announce
let uploaded_delta;
Expand Down

0 comments on commit e36eb94

Please sign in to comment.