mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
- Wait for torrent_paused_alert before saving fast resume data
This commit is contained in:
parent
3494702437
commit
f9c357b52d
3
TODO
3
TODO
@ -49,7 +49,7 @@
|
|||||||
- Clean up delayed progress column sorting code
|
- Clean up delayed progress column sorting code
|
||||||
- Clean up pause after checking code
|
- Clean up pause after checking code
|
||||||
- Test rss now that it has been rewritten
|
- Test rss now that it has been rewritten
|
||||||
- Wait for torrent_paused_alert before saving fast resume data
|
- Fix number of finishedChecking torrents
|
||||||
- Wait for some bug fixes in libtorrent :
|
- Wait for some bug fixes in libtorrent :
|
||||||
- upload/download limit per torrent (Ticket #83)
|
- upload/download limit per torrent (Ticket #83)
|
||||||
- double free or corruption on exit (Ticket #84) FIXED?
|
- double free or corruption on exit (Ticket #84) FIXED?
|
||||||
@ -68,6 +68,7 @@ LANGUAGES UPDATED:
|
|||||||
- Polish *BETA5*
|
- Polish *BETA5*
|
||||||
|
|
||||||
beta4->beta5 changelog:
|
beta4->beta5 changelog:
|
||||||
|
- BUGFIX: Wait for torrent_paused_alert before saving fast resume data
|
||||||
- BUGFIX: Finished torrents were still displayed as checking when paused by libtorrent on full disk (hit an assert)
|
- BUGFIX: Finished torrents were still displayed as checking when paused by libtorrent on full disk (hit an assert)
|
||||||
- I18N: Updated Italian translation
|
- I18N: Updated Italian translation
|
||||||
- COSMETIC: Changed the way progress bars are rendered
|
- COSMETIC: Changed the way progress bars are rendered
|
||||||
|
@ -211,7 +211,6 @@ GUI::~GUI(){
|
|||||||
delete finishedTorrentTab;
|
delete finishedTorrentTab;
|
||||||
delete checkConnect;
|
delete checkConnect;
|
||||||
delete refresher;
|
delete refresher;
|
||||||
delete BTSession;
|
|
||||||
if(systrayIntegration){
|
if(systrayIntegration){
|
||||||
delete myTrayIcon;
|
delete myTrayIcon;
|
||||||
delete myTrayIconMenu;
|
delete myTrayIconMenu;
|
||||||
@ -228,6 +227,7 @@ GUI::~GUI(){
|
|||||||
delete switchDownShortcut;
|
delete switchDownShortcut;
|
||||||
delete switchUpShortcut;
|
delete switchUpShortcut;
|
||||||
delete switchRSSShortcut;
|
delete switchRSSShortcut;
|
||||||
|
delete BTSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::on_actionWebsite_triggered(){
|
void GUI::on_actionWebsite_triggered(){
|
||||||
|
@ -188,6 +188,10 @@ void bittorrent::deleteTorrent(QString hash, bool permanent){
|
|||||||
int index = fullAllocationModeList.indexOf(hash);
|
int index = fullAllocationModeList.indexOf(hash);
|
||||||
if(index != -1)
|
if(index != -1)
|
||||||
fullAllocationModeList.removeAt(index);
|
fullAllocationModeList.removeAt(index);
|
||||||
|
// Remove it from pausedTorrents list
|
||||||
|
index = pausedTorrents.indexOf(hash);
|
||||||
|
if(index != -1)
|
||||||
|
pausedTorrents.removeAt(index);
|
||||||
if(permanent){
|
if(permanent){
|
||||||
// Remove from Hard drive
|
// Remove from Hard drive
|
||||||
qDebug("Removing this on hard drive: %s", qPrintable(savePath+QDir::separator()+fileName));
|
qDebug("Removing this on hard drive: %s", qPrintable(savePath+QDir::separator()+fileName));
|
||||||
@ -242,6 +246,10 @@ bool bittorrent::resumeTorrent(QString hash){
|
|||||||
torrentsToPauseAfterChecking.removeAt(index);
|
torrentsToPauseAfterChecking.removeAt(index);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
// Remove it from pausedTorrents list
|
||||||
|
index = pausedTorrents.indexOf(hash);
|
||||||
|
if(index != -1)
|
||||||
|
pausedTorrents.removeAt(index);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -646,6 +654,10 @@ void bittorrent::saveDownloadUploadForTorrent(QString hash){
|
|||||||
ratio_file.close();
|
ratio_file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool bittorrent::receivedPausedAlert(QString hash) const{
|
||||||
|
return (pausedTorrents.indexOf(hash) != -1);
|
||||||
|
}
|
||||||
|
|
||||||
// Save fastresume data for all torrents
|
// Save fastresume data for all torrents
|
||||||
// and remove them from the session
|
// and remove them from the session
|
||||||
void bittorrent::saveFastResumeAndRatioData(){
|
void bittorrent::saveFastResumeAndRatioData(){
|
||||||
@ -667,9 +679,13 @@ void bittorrent::saveFastResumeAndRatioData(){
|
|||||||
}
|
}
|
||||||
// Pause download (needed before fast resume writing)
|
// Pause download (needed before fast resume writing)
|
||||||
h.pause();
|
h.pause();
|
||||||
|
QString fileHash = QString(misc::toString(h.info_hash()).c_str());
|
||||||
|
while(!receivedPausedAlert(fileHash)){
|
||||||
|
SleeperThread::msleep(500);
|
||||||
|
readAlerts();
|
||||||
|
}
|
||||||
// Extracting resume data
|
// Extracting resume data
|
||||||
if (h.has_metadata()){
|
if (h.has_metadata()){
|
||||||
QString fileHash = QString(misc::toString(h.info_hash()).c_str());
|
|
||||||
if(QFile::exists(torrentBackup.path()+QDir::separator()+fileHash+".torrent")){
|
if(QFile::exists(torrentBackup.path()+QDir::separator()+fileHash+".torrent")){
|
||||||
// Remove old .fastresume data in case it exists
|
// Remove old .fastresume data in case it exists
|
||||||
QFile::remove(torrentBackup.path()+QDir::separator()+fileHash + ".fastresume");
|
QFile::remove(torrentBackup.path()+QDir::separator()+fileHash + ".fastresume");
|
||||||
@ -908,10 +924,17 @@ void bittorrent::readAlerts(){
|
|||||||
emit trackerAuthenticationRequired(p->handle);
|
emit trackerAuthenticationRequired(p->handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (torrent_paused_alert* p = dynamic_cast<torrent_paused_alert*>(a.get())){
|
||||||
|
QString hash = QString(misc::toString(p->handle.info_hash()).c_str());
|
||||||
|
qDebug("Received torrent_paused_alert for %s", (const char*)hash.toUtf8());
|
||||||
|
Q_ASSERT(!pausedTorrents.contains(hash));
|
||||||
|
pausedTorrents << hash;
|
||||||
|
}
|
||||||
else if (peer_blocked_alert* p = dynamic_cast<peer_blocked_alert*>(a.get())){
|
else if (peer_blocked_alert* p = dynamic_cast<peer_blocked_alert*>(a.get())){
|
||||||
emit peerBlocked(QString(p->ip.to_string().c_str()));
|
emit peerBlocked(QString(p->ip.to_string().c_str()));
|
||||||
}
|
}
|
||||||
else if (fastresume_rejected_alert* p = dynamic_cast<fastresume_rejected_alert*>(a.get())){
|
else if (fastresume_rejected_alert* p = dynamic_cast<fastresume_rejected_alert*>(a.get())){
|
||||||
|
qDebug("/!\\ Fast resume failed for %s, reason: %s", p->handle.name().c_str(), p->msg().c_str());
|
||||||
emit fastResumeDataRejected(QString(p->handle.name().c_str()));
|
emit fastResumeDataRejected(QString(p->handle.name().c_str()));
|
||||||
}
|
}
|
||||||
else if (url_seed_alert* p = dynamic_cast<url_seed_alert*>(a.get())){
|
else if (url_seed_alert* p = dynamic_cast<url_seed_alert*>(a.get())){
|
||||||
|
@ -56,6 +56,7 @@ class bittorrent : public QObject{
|
|||||||
QList<QString> fullAllocationModeList;
|
QList<QString> fullAllocationModeList;
|
||||||
QHash<QString, QList<QPair<QString, QString> > > trackersErrors;
|
QHash<QString, QList<QPair<QString, QString> > > trackersErrors;
|
||||||
deleteThread *deleter;
|
deleteThread *deleter;
|
||||||
|
QList<QString> pausedTorrents;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString getSavePath(QString hash);
|
QString getSavePath(QString hash);
|
||||||
@ -82,6 +83,7 @@ class bittorrent : public QObject{
|
|||||||
float getRealRatio(QString hash) const;
|
float getRealRatio(QString hash) const;
|
||||||
session* getSession() const;
|
session* getSession() const;
|
||||||
QList<QPair<QString, QString> > getTrackersErrors(QString hash) const;
|
QList<QPair<QString, QString> > getTrackersErrors(QString hash) const;
|
||||||
|
bool receivedPausedAlert(QString hash) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void addTorrent(QString path, bool fromScanDir = false, bool onStartup = false, QString from_url = QString());
|
void addTorrent(QString path, bool fromScanDir = false, bool onStartup = false, QString from_url = QString());
|
||||||
|
Loading…
Reference in New Issue
Block a user