|
|
|
|
#include <TorrentContext.hpp>
|
|
|
|
|
|
|
|
|
|
TorrentStatus &TestTorrent::status(int type) {
|
|
|
|
|
return status_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TestTorrent::is_valid() const {
|
|
|
|
|
return valid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TestTorrent::upload_limit() const {
|
|
|
|
|
return upload_limit_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TestTorrent::download_limit() const {
|
|
|
|
|
return download_limit_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TestTorrent::TestTorrent(const libtorrent::add_torrent_params ¶ms) {
|
|
|
|
|
const auto paused = (params.flags & libtorrent::add_torrent_params::flag_paused) == libtorrent::add_torrent_params::flag_paused;
|
|
|
|
|
status_.paused = paused;
|
|
|
|
|
status_.save_path = params.save_path;
|
|
|
|
|
status_.name = params.name;
|
|
|
|
|
upload_limit_ = params.upload_limit;
|
|
|
|
|
download_limit_ = params.download_limit;
|
|
|
|
|
hash_ = params.info_hash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
libtorrent::sha1_hash TestTorrent::info_hash() const {
|
|
|
|
|
return hash_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TestTorrent::pause(int flags) {
|
|
|
|
|
status_.paused = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TestTorrent::resume() {
|
|
|
|
|
status_.paused = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TestTorrent::set_download_limit(int limit) {
|
|
|
|
|
download_limit_ = limit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TestTorrent::set_upload_limit(int limit) {
|
|
|
|
|
upload_limit_ = limit;
|
|
|
|
|
}
|