bug修复调整
This commit is contained in:
1 parent
28e0c4664a
commit
6b9f71da08
35 files changed
+1004
-296
No files matched your search
@@ -414,13 +414,21 @@ impl TorrentDownloader {
|
||||
.map_err(|e| format!("暂停种子失败: {}", e))
|
||||
}
|
||||
|
||||
/// 继续种子
|
||||
/// 继续种子(幂等):恢复已暂停的种子。
|
||||
/// 若种子本已处于 Live(例如 select_bt_files 的 set_only_files 内部已恢复过、
|
||||
/// 或暂停期间被其他逻辑恢复),直接视为成功,避免 librqbit 报 "torrent is already live"
|
||||
/// 而导致 pause→resume 链路被误判为失败。
|
||||
pub async fn unpause(&self, handle: &Arc<ManagedTorrent>) -> Result<(), String> {
|
||||
let session = self.get_session().await?;
|
||||
session
|
||||
.unpause(handle)
|
||||
.await
|
||||
.map_err(|e| format!("继续种子失败: {}", e))
|
||||
match handle.stats().state {
|
||||
librqbit::TorrentStatsState::Live => Ok(()),
|
||||
librqbit::TorrentStatsState::Error => Err("种子处于错误状态,无法继续".to_string()),
|
||||
librqbit::TorrentStatsState::Paused
|
||||
| librqbit::TorrentStatsState::Initializing { .. } => session
|
||||
.unpause(handle)
|
||||
.await
|
||||
.map_err(|e| format!("继续种子失败: {}", e)),
|
||||
}
|
||||
}
|
||||
|
||||
/// 删除种子(info_hash 为 hex 字符串;delete_files 是否同时删除已下载文件)
|
||||
|
||||
Reference in new issue
Block a user