From: P2P-Next Date: Mon, 9 Aug 2010 19:22:17 +0000 (+0300) Subject: instrumentation/hrktorrent: set local network limits in core if --limitlocal option... X-Git-Tag: getopt_long~3 X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=c74ad899ee47c8e2b4ca599022ff33c9cd5580dc;p=cs-p2p-next.git instrumentation/hrktorrent: set local network limits in core if --limitlocal option is enabled --- diff --git a/instrumentation/hrktorrent/core.cpp b/instrumentation/hrktorrent/core.cpp index c21bb64..f06f403 100644 --- a/instrumentation/hrktorrent/core.cpp +++ b/instrumentation/hrktorrent/core.cpp @@ -240,23 +240,26 @@ CCore::Run() _session = new libtorrent::session(libtorrent::fingerprint("HT", MAJOR, MINOR, REVISION, TAG)); + libtorrent::session_settings ss; + if(Settings->GetI("upnp") > 0) _session->start_upnp(); _session->listen_on(std::make_pair(Settings->GetI("minport"), Settings->GetI("maxport"))); + if (Settings->GetI("limitlocal") > 0) { + ss.ignore_limits_on_local_network = false; + } if(Settings->GetI("maxup") > 0) { _session->set_upload_rate_limit(Settings->GetI("maxup")*1024); - _session->set_local_upload_rate_limit(Settings->GetI("maxup")*1024); } - if(Settings->GetI("maxdown") > 0){ + if(Settings->GetI("maxdown") > 0) { _session->set_download_rate_limit(Settings->GetI("maxdown")*1024); - _session->set_local_download_rate_limit(Settings->GetI("maxdown")*1024); } try { libtorrent::add_torrent_params parms; boost::intrusive_ptr info = new libtorrent::torrent_info(_argv[_argc-1]); - boost::filesystem::path p(Settings->GetS("downloaddir")); + boost::filesystem::path p(Settings->GetS("outputdir")); boost::filesystem::create_directory(p); if(!boost::filesystem::exists(p)) { std::cerr << "Download directory does not exist/could not be created." << std::endl; @@ -290,6 +293,9 @@ CCore::Run() _session->set_ip_filter(IPFilter->getFilter()); } + /* add settings */ + _session->set_settings(ss); + ScheduleSignal(SIGINT); std::cout << "\"CTRL-C\" shuts hrktorrent down.\n" << std::endl; @@ -318,4 +324,3 @@ CCore::VerbosePrint(std::string source, std::string message) std::cout << "[" << source << "] "; std::cout << message << std::endl; } -