mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 14:57:52 +00:00
- Fixed bad assert
- Little checking before saving url seeds list - Little optimization to make fastresume data saving faster
This commit is contained in:
parent
5315ba7894
commit
04352cce3c
@ -692,7 +692,7 @@ void bittorrent::saveFastResumeAndRatioData(){
|
|||||||
if(! torrentBackup.exists()){
|
if(! torrentBackup.exists()){
|
||||||
torrentBackup.mkpath(torrentBackup.path());
|
torrentBackup.mkpath(torrentBackup.path());
|
||||||
}
|
}
|
||||||
// Write fast resume data
|
// Pause torrents
|
||||||
std::vector<torrent_handle> handles = s->get_torrents();
|
std::vector<torrent_handle> handles = s->get_torrents();
|
||||||
for(unsigned int i=0; i<handles.size(); ++i){
|
for(unsigned int i=0; i<handles.size(); ++i){
|
||||||
torrent_handle &h = handles[i];
|
torrent_handle &h = handles[i];
|
||||||
@ -702,11 +702,19 @@ void bittorrent::saveFastResumeAndRatioData(){
|
|||||||
}
|
}
|
||||||
// Pause download (needed before fast resume writing)
|
// Pause download (needed before fast resume writing)
|
||||||
h.pause();
|
h.pause();
|
||||||
|
}
|
||||||
|
// Write fast resume data
|
||||||
|
for(unsigned int i=0; i<handles.size(); ++i){
|
||||||
|
torrent_handle &h = handles[i];
|
||||||
|
if(!h.is_valid()){
|
||||||
|
qDebug("/!\\ Error: Invalid handle");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
QString fileHash = QString(misc::toString(h.info_hash()).c_str());
|
QString fileHash = QString(misc::toString(h.info_hash()).c_str());
|
||||||
while(!receivedPausedAlert(fileHash)){
|
while(!receivedPausedAlert(fileHash)){
|
||||||
//qDebug("Sleeping while waiting that %s is paused", misc::toString(h.info_hash()).c_str());
|
//qDebug("Sleeping while waiting that %s is paused", misc::toString(h.info_hash()).c_str());
|
||||||
//printPausedTorrents();
|
//printPausedTorrents();
|
||||||
SleeperThread::msleep(500);
|
SleeperThread::msleep(300);
|
||||||
readAlerts();
|
readAlerts();
|
||||||
}
|
}
|
||||||
// Extracting resume data
|
// Extracting resume data
|
||||||
@ -1042,7 +1050,7 @@ void bittorrent::reloadTorrent(const torrent_handle &h){
|
|||||||
}
|
}
|
||||||
// Write fast resume data
|
// Write fast resume data
|
||||||
// Torrent is already paused
|
// Torrent is already paused
|
||||||
Q_ASSERT(pausedTorrents.indexOf(fileHash) != 1);
|
Q_ASSERT(pausedTorrents.indexOf(fileHash) != -1);
|
||||||
// Extracting resume data
|
// Extracting resume data
|
||||||
if (h.has_metadata()){
|
if (h.has_metadata()){
|
||||||
// get fast resume data
|
// get fast resume data
|
||||||
|
@ -365,17 +365,21 @@ void properties::deleteSelectedUrlSeeds(){
|
|||||||
QList<QListWidgetItem *> selectedItems;
|
QList<QListWidgetItem *> selectedItems;
|
||||||
selectedItems = listWebSeeds->selectedItems();
|
selectedItems = listWebSeeds->selectedItems();
|
||||||
QListWidgetItem *item;
|
QListWidgetItem *item;
|
||||||
|
bool change = false;
|
||||||
foreach(item, selectedItems){
|
foreach(item, selectedItems){
|
||||||
QString url_seed = item->text();
|
QString url_seed = item->text();
|
||||||
int index = urlSeeds.indexOf(url_seed);
|
int index = urlSeeds.indexOf(url_seed);
|
||||||
Q_ASSERT(index != -1);
|
Q_ASSERT(index != -1);
|
||||||
urlSeeds.removeAt(index);
|
urlSeeds.removeAt(index);
|
||||||
h.remove_url_seed(misc::toString((const char*)url_seed.toUtf8()));
|
h.remove_url_seed(misc::toString((const char*)url_seed.toUtf8()));
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
if(change){
|
||||||
|
// Save them to disk
|
||||||
|
saveWebSeeds();
|
||||||
|
// Refresh list
|
||||||
|
loadWebSeeds();
|
||||||
}
|
}
|
||||||
// Save them to disk
|
|
||||||
saveWebSeeds();
|
|
||||||
// Refresh list
|
|
||||||
loadWebSeeds();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void properties::deleteSelectedTrackers(){
|
void properties::deleteSelectedTrackers(){
|
||||||
|
Loading…
Reference in New Issue
Block a user