Merge pull request #13206 from an0n666/revert-seed-mode-patch

Read piece for torrents added with skip hash only for older libtorrent
This commit is contained in:
Mike Tzou 2020-08-03 19:56:37 +08:00 committed by GitHub
commit 3a61042e40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -4226,9 +4226,11 @@ void Session::handleAlert(const lt::alert *a)
case lt::file_error_alert::alert_type:
handleFileErrorAlert(static_cast<const lt::file_error_alert*>(a));
break;
#if (LIBTORRENT_VERSION_NUM < 10208)
case lt::read_piece_alert::alert_type:
handleReadPieceAlert(static_cast<const lt::read_piece_alert*>(a));
break;
#endif
case lt::add_torrent_alert::alert_type:
handleAddTorrentAlert(static_cast<const lt::add_torrent_alert*>(a));
break;
@ -4359,9 +4361,11 @@ void Session::createTorrentHandle(const lt::torrent_handle &nativeHandle)
if (torrent->hasError())
LogMsg(tr("Torrent errored. Torrent: \"%1\". Error: %2.").arg(torrent->name(), torrent->error()), Log::WARNING);
// Check if file(s) exist when using seed mode
#if (LIBTORRENT_VERSION_NUM < 10208)
// Check if file(s) exist when using skip hash check
if (params.skipChecking && torrent->hasMetadata())
nativeHandle.read_piece(lt::piece_index_t(0));
#endif
}
void Session::handleAddTorrentAlert(const lt::add_torrent_alert *p)
@ -4466,6 +4470,7 @@ void Session::handleFileErrorAlert(const lt::file_error_alert *p)
m_recentErroredTorrentsTimer->start();
}
#if (LIBTORRENT_VERSION_NUM < 10208)
void Session::handleReadPieceAlert(const lt::read_piece_alert *p) const
{
if (p->error) {
@ -4473,6 +4478,7 @@ void Session::handleReadPieceAlert(const lt::read_piece_alert *p) const
p->handle.force_recheck();
}
}
#endif
void Session::handlePortmapWarningAlert(const lt::portmap_error_alert *p)
{

View file

@ -590,7 +590,9 @@ namespace BitTorrent
void handleStateUpdateAlert(const lt::state_update_alert *p);
void handleMetadataReceivedAlert(const lt::metadata_received_alert *p);
void handleFileErrorAlert(const lt::file_error_alert *p);
#if (LIBTORRENT_VERSION_NUM < 10208)
void handleReadPieceAlert(const lt::read_piece_alert *p) const;
#endif
void handleTorrentRemovedAlert(const lt::torrent_removed_alert *p);
void handleTorrentDeletedAlert(const lt::torrent_deleted_alert *p);
void handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed_alert *p);