if (ta) {
+
+ if (!ta->handle.is_valid()) {
+ qDebug() << "handle is invalid";
+ return;
+ }
+
TorrentHandle handle(ta->handle);
TorrentState state;
state.hash = Hash2QStr(handle.hash());
+ state.is_new = false;
state.state = handle.state();
state.progress = handle.progress() * torrent_progress_max;
state.down_rate = handle.downloadRate();
state.hash = hash;
state.name = handle->name();
+ state.is_new = true;
state.state = handle->state();
state.progress = handle->progress() * torrent_progress_max;
state.down_rate = handle->downloadRate();
qDebug() << "addTorrent: " << path << " save to " << save_path;
boost::intrusive_ptr<libtorrent::torrent_info> tiTmp
- = new libtorrent::torrent_info(path.toStdString());
+ = new libtorrent::torrent_info
+ (boost::filesystem::path(path.toStdString()));
addParams.ti = tiTmp;
// save_path is the only mandatory parameter, rest are optional.
- addParams.save_path = save_path.toStdString();
+ addParams.save_path = boost::filesystem::path(save_path.toStdString());
//addParams.storage_mode = libtorrent::storage_mode_allocate;
TorrentHandlePtr handle(new TorrentHandle(btSession_.add_torrent(addParams)));
state.hash = hash;
state.name = handle->name();
+ state.is_new = true;
state.state = handle->state();
state.progress = handle->progress() * torrent_progress_max;
state.down_rate = handle->downloadRate();