From c74ad899ee47c8e2b4ca599022ff33c9cd5580dc Mon Sep 17 00:00:00 2001 From: P2P-Next Date: Mon, 9 Aug 2010 22:22:17 +0300 Subject: [PATCH] instrumentation/hrktorrent: set local network limits in core if --limitlocal option is enabled --- instrumentation/hrktorrent/core.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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; } - -- 2.20.1