added initial support for share-mode

This commit is contained in:
Arvid Norberg
2010-09-05 16:01:36 +00:00
parent a8cc326df6
commit b6f92aa981
16 changed files with 377 additions and 17 deletions

View File

@@ -530,6 +530,8 @@ std::string outgoing_interface = "";
int poll_interval = 5;
int max_connections_per_torrent = 50;
bool share_mode = false;
using boost::bind;
// monitored_dir is true if this torrent is added because
@@ -560,6 +562,7 @@ void add_torrent(libtorrent::session& ses
printf("%s\n", t->name().c_str());
add_torrent_params p;
p.share_mode = share_mode;
lazy_entry resume_data;
std::string filename = combine_path(save_path, t->name() + ".resume");
@@ -810,7 +813,7 @@ int main(int argc, char* argv[])
//settings.announce_to_all_trackers = true;
settings.optimize_hashing_for_speed = false;
settings.disk_cache_algorithm = session_settings::largest_contiguous;
settings.volatile_read_cache = true;
settings.volatile_read_cache = false;
proxy_settings ps;
@@ -868,6 +871,7 @@ int main(int argc, char* argv[])
from_hex(argv[i], 40, (char*)&info_hash[0]);
add_torrent_params p;
p.share_mode = share_mode;
p.tracker_url = argv[i] + 41;
p.info_hash = info_hash;
p.save_path = save_path;
@@ -908,6 +912,7 @@ int main(int argc, char* argv[])
case 'U': torrent_upload_limit = atoi(arg) * 1000; break;
case 'D': torrent_download_limit = atoi(arg) * 1000; break;
case 'm': monitor_dir = arg; break;
case 'M': share_mode = true; --i; break;
case 'b': bind_to_interface = arg; break;
case 'w': settings.urlseed_wait_retry = atoi(arg); break;
case 't': poll_interval = atoi(arg); break;
@@ -1053,6 +1058,7 @@ int main(int argc, char* argv[])
if (std::strstr(i->c_str(), "magnet:") == i->c_str())
{
add_torrent_params p;
p.share_mode = share_mode;
p.save_path = save_path;
p.storage_mode = (storage_mode_t)allocation_mode;
printf("adding MANGET link: %s\n", i->c_str());
@@ -1404,7 +1410,7 @@ int main(int argc, char* argv[])
out += str;
}
if (print_piece_bar && s.progress_ppm < 1000000 && s.progress > 0)
if (print_piece_bar && s.state != torrent_status::seeding)
{
out += " ";
out += piece_bar(s.pieces, terminal_width - 7);