|
|
@ -85,11 +85,10 @@ void bittorrent::preAllocateAllFiles(bool b) { |
|
|
|
if(change) { |
|
|
|
if(change) { |
|
|
|
qDebug("PreAllocateAll changed, reloading all torrents!"); |
|
|
|
qDebug("PreAllocateAll changed, reloading all torrents!"); |
|
|
|
preAllocateAll = b; |
|
|
|
preAllocateAll = b; |
|
|
|
// Reload All Torrents
|
|
|
|
// Reload All unfinished torrents
|
|
|
|
std::vector<torrent_handle> handles = s->get_torrents(); |
|
|
|
QString hash; |
|
|
|
unsigned int nbHandles = handles.size(); |
|
|
|
foreach(hash, unfinishedTorrents) { |
|
|
|
for(unsigned int i=0; i<nbHandles; ++i) { |
|
|
|
QTorrentHandle h = getTorrentHandle(hash); |
|
|
|
QTorrentHandle h = handles[i]; |
|
|
|
|
|
|
|
if(!h.is_valid()) { |
|
|
|
if(!h.is_valid()) { |
|
|
|
qDebug("/!\\ Error: Invalid handle"); |
|
|
|
qDebug("/!\\ Error: Invalid handle"); |
|
|
|
continue; |
|
|
|
continue; |
|
|
@ -1226,6 +1225,7 @@ void bittorrent::reloadTorrent(const QTorrentHandle &h, bool full_alloc) { |
|
|
|
// Add torrent again to session
|
|
|
|
// Add torrent again to session
|
|
|
|
unsigned int timeout = 0; |
|
|
|
unsigned int timeout = 0; |
|
|
|
while(h.is_valid() && timeout < 6) { |
|
|
|
while(h.is_valid() && timeout < 6) { |
|
|
|
|
|
|
|
qDebug("Waiting for the torrent to be removed..."); |
|
|
|
SleeperThread::msleep(1000); |
|
|
|
SleeperThread::msleep(1000); |
|
|
|
++timeout; |
|
|
|
++timeout; |
|
|
|
} |
|
|
|
} |
|
|
|