Summary: | Data lost when changing the download directory | ||
---|---|---|---|
Product: | [Applications] ktorrent | Reporter: | Henri Hesse <henri.hesse> |
Component: | general | Assignee: | Joris Guisson <joris.guisson> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Henri Hesse
2007-06-20 13:58:47 UTC
Is this torrent controlled by the QM ? Yes, it was... and I tested to do the same thing to a torrent that is user controlled and discovered that torrent automatically stops untill the transfer is complete :-) So the problem obviously has something to do with the QM. We stop the torrent, but the QM starts it again. SVN commit 678949 by guisson: Make sure QM cannot start torrents which are currently moving their data files. BUG: 146997 M +3 -0 interfaces/torrentinterface.h M +1 -1 torrent/queuemanager.cpp M +9 -2 torrent/torrentcontrol.cpp M +4 -2 torrent/torrentcontrol.h --- branches/extragear/kde3/network/ktorrent/libktorrent/interfaces/torrentinterface.h #678948:678949 @@ -428,6 +428,9 @@ /// Check if there is enough diskspace available for this torrent virtual bool checkDiskSpace(bool emit_sig = true) = 0; + + /// Are we in the process of moving files + virtual bool isMovingFiles() const = 0; signals: /** * Emited when we have finished downloading. --- branches/extragear/kde3/network/ktorrent/libktorrent/torrent/queuemanager.cpp #678948:678949 @@ -474,7 +474,7 @@ ++user_seeding; } - if (!s.user_controlled) + if (!s.user_controlled && !tc->isMovingFiles()) { if (s.completed) seed_queue.append(tc); --- branches/extragear/kde3/network/ktorrent/libktorrent/torrent/torrentcontrol.cpp #678948:678949 @@ -117,6 +117,7 @@ // by default no torrent limits upload_gid = download_gid = 0; upload_limit = download_limit = 0; + moving_files = false; } @@ -142,7 +143,7 @@ void TorrentControl::update() { UpdateCurrentTime(); - if (stats.status == kt::CHECKING_DATA) + if (stats.status == kt::CHECKING_DATA || moving_files) return; if (istats.io_error) @@ -322,7 +323,7 @@ void TorrentControl::start() { // do not start running torrents - if (stats.running || stats.status == kt::ALLOCATING_DISKSPACE) + if (stats.running || stats.status == kt::ALLOCATING_DISKSPACE || moving_files) return; stats.stopped_by_error = false; @@ -817,6 +818,7 @@ Out(SYS_GEN|LOG_NOTICE) << "Moving data for torrent " << stats.torrent_name << " to " << new_dir << endl; bool start = false; + int old_prio = getPriority(); //check if torrent is running and stop it before moving data if(stats.running) @@ -825,6 +827,7 @@ this->stop(false); } + moving_files = true; try { QString nd; @@ -858,11 +861,15 @@ catch (Error& err) { Out(SYS_GEN|LOG_IMPORTANT) << "Could not move " << stats.output_path << " to " << new_dir << ". Exception: " << err.toString() << endl; + moving_files = false; return false; } + moving_files = false; if(start) + { this->start(); + } return true; } --- branches/extragear/kde3/network/ktorrent/libktorrent/torrent/torrentcontrol.h #678948:678949 @@ -260,6 +260,9 @@ ///Get the PeerManager const PeerManager * getPeerMgr() const; + /// Are we in the process of moving files + bool isMovingFiles() const {return moving_files;} + public slots: /** * Update the object, should be called periodically. @@ -344,10 +347,9 @@ bool prealloc; PreallocationThread* prealoc_thread; - DataCheckerThread* dcheck_thread; - TimeStamp last_diskspace_check; + bool moving_files; struct InternalStats { |