mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 17:15:35 +00:00
implement initial_peers method
This commit is contained in:
parent
41b386717d
commit
003564f52c
2 changed files with 7 additions and 11 deletions
|
|
@ -68,11 +68,7 @@ async fn main() -> Result<()> {
|
|||
Some(AddTorrentOptions {
|
||||
overwrite: true,
|
||||
disable_trackers: trackers.is_empty(),
|
||||
initial_peers: if peers.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(peers.clone())
|
||||
},
|
||||
initial_peers: peers.initial_peers(),
|
||||
// preload nothing, but listing when regex pattern argument is given
|
||||
list_only: arg.preload_regex.is_none(),
|
||||
// this option allows rqbit manager to preload some or any files match pattern
|
||||
|
|
|
|||
12
src/peers.rs
12
src/peers.rs
|
|
@ -11,11 +11,11 @@ impl Peers {
|
|||
Ok(Self(p))
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.0.is_empty()
|
||||
}
|
||||
|
||||
pub fn clone(&self) -> Vec<SocketAddr> {
|
||||
self.0.clone()
|
||||
pub fn initial_peers(&self) -> Option<Vec<SocketAddr>> {
|
||||
if self.0.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(self.0.clone())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue