Browse Source

Startup optimization

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
e17ca355ae
  1. 35
      src/bittorrent.cpp

35
src/bittorrent.cpp

@ -1824,24 +1824,25 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
} }
} }
bool was_already_seeded = TorrentPersistentData::isSeed(hash); bool was_already_seeded = TorrentPersistentData::isSeed(hash);
if(!was_already_seeded) if(!was_already_seeded) {
h.save_resume_data(); h.save_resume_data();
// Check if there are torrent files inside // Check if there are torrent files inside
for(int i=0; i<h.get_torrent_info().num_files(); ++i) { for(int i=0; i<h.get_torrent_info().num_files(); ++i) {
QString torrent_relpath = misc::toQString(h.get_torrent_info().file_at(i).path); QString torrent_relpath = misc::toQString(h.get_torrent_info().file_at(i).path);
if(torrent_relpath.endsWith(".torrent")) { if(torrent_relpath.endsWith(".torrent")) {
addConsoleMessage(tr("Recursive download of file %1 embedded in torrent %2", "Recursive download of test.torrent embedded in torrent test2").arg(torrent_relpath).arg(h.name())); addConsoleMessage(tr("Recursive download of file %1 embedded in torrent %2", "Recursive download of test.torrent embedded in torrent test2").arg(torrent_relpath).arg(h.name()));
QString torrent_fullpath = h.save_path()+QDir::separator()+torrent_relpath; QString torrent_fullpath = h.save_path()+QDir::separator()+torrent_relpath;
boost::intrusive_ptr<torrent_info> t; boost::intrusive_ptr<torrent_info> t;
try { try {
t = new torrent_info(torrent_fullpath.toLocal8Bit().data()); t = new torrent_info(torrent_fullpath.toLocal8Bit().data());
QString sub_hash = misc::toQString(t->info_hash()); QString sub_hash = misc::toQString(t->info_hash());
// Passing the save path along to the sub torrent file // Passing the save path along to the sub torrent file
TorrentTempData::setSavePath(sub_hash, h.save_path()); TorrentTempData::setSavePath(sub_hash, h.save_path());
addTorrent(torrent_fullpath); addTorrent(torrent_fullpath);
} catch(std::exception&) { } catch(std::exception&) {
qDebug("Caught error loading torrent"); qDebug("Caught error loading torrent");
addConsoleMessage(tr("Unable to decode %1 torrent file.").arg(torrent_fullpath), QString::fromUtf8("red")); addConsoleMessage(tr("Unable to decode %1 torrent file.").arg(torrent_fullpath), QString::fromUtf8("red"));
}
} }
} }
} }

Loading…
Cancel
Save