Browse Source

Fix torrent state calculation

adaptive-webui-19844
Vladimir Golovnev (Glassez) 4 years ago
parent
commit
80ca7796ca
No known key found for this signature in database
GPG Key ID: 52A2C7DEE2DFA6F7
  1. 25
      src/base/bittorrent/torrenthandleimpl.cpp

25
src/base/bittorrent/torrenthandleimpl.cpp

@ -743,7 +743,22 @@ void TorrentHandleImpl::updateState()
if (m_nativeStatus.state == lt::torrent_status::checking_resume_data) { if (m_nativeStatus.state == lt::torrent_status::checking_resume_data) {
m_state = TorrentState::CheckingResumeData; m_state = TorrentState::CheckingResumeData;
} }
else if (m_nativeStatus.state == lt::torrent_status::checking_files) { else if (isPaused()) {
if (isMoveInProgress()) {
m_state = TorrentState::Moving;
}
else if (hasMissingFiles()) {
m_state = TorrentState::MissingFiles;
}
else if (hasError()) {
m_state = TorrentState::Error;
}
else {
m_state = isSeed() ? TorrentState::PausedUploading : TorrentState::PausedDownloading;
}
}
else {
if (m_nativeStatus.state == lt::torrent_status::checking_files) {
m_state = m_hasSeedStatus ? TorrentState::CheckingUploading : TorrentState::CheckingDownloading; m_state = m_hasSeedStatus ? TorrentState::CheckingUploading : TorrentState::CheckingDownloading;
} }
else if (m_nativeStatus.state == lt::torrent_status::allocating) { else if (m_nativeStatus.state == lt::torrent_status::allocating) {
@ -752,14 +767,11 @@ void TorrentHandleImpl::updateState()
else if (isMoveInProgress()) { else if (isMoveInProgress()) {
m_state = TorrentState::Moving; m_state = TorrentState::Moving;
} }
else if (hasError()) {
m_state = TorrentState::Error;
}
else if (hasMissingFiles()) { else if (hasMissingFiles()) {
m_state = TorrentState::MissingFiles; m_state = TorrentState::MissingFiles;
} }
else if (isPaused()) { else if (hasError()) {
m_state = isSeed() ? TorrentState::PausedUploading : TorrentState::PausedDownloading; m_state = TorrentState::Error;
} }
else if (m_session->isQueueingSystemEnabled() && isQueued() && !isChecking()) { else if (m_session->isQueueingSystemEnabled() && isQueued() && !isChecking()) {
m_state = isSeed() ? TorrentState::QueuedUploading : TorrentState::QueuedDownloading; m_state = isSeed() ? TorrentState::QueuedUploading : TorrentState::QueuedDownloading;
@ -788,6 +800,7 @@ void TorrentHandleImpl::updateState()
} }
} }
} }
}
bool TorrentHandleImpl::hasMetadata() const bool TorrentHandleImpl::hasMetadata() const
{ {

Loading…
Cancel
Save