Jerome Stolfo wrote:
(sorry, I sent it to your mail instead of the mailing list)


Ok, I didn't understand.

Would it be possible to add an option that works just like the --no_check_hashes option from the official bittorrent client ? This parameter assumes that every complete file added to the list is correct, and therefore doesn't hash it at all and starts uploading immediately.

Or maybe suggest a patch that would deactivate hashing at all? (I only use this to upload complete files, never to download)

I would need it because we usually seed more that 100-150 files at once on our server (game demos mostly), and as they are pretty heavy, and the server is uploading at 50 Mbps at the same time, they take hours to hash.

For now we are launching several process of the official python client to do that, but it takes too much cpu and ram, rtorrent is a lot less hungry in ressources :-)

I won't add such a flag as I'd rather not trust the users to ensure they really do have the complete file. Besides, it isn't the right problem we need to solve.

After some thought i realize that clearing the "tied_to_file" when deleting files from the watch directory probably isn't the right thing to do. So by retaining that I'm able to add a "start_tied" option.

Just use "start_tied" like the watch directory, in addition to that and close_untied. Should give you the desired behavior when you move torrents to and from the watched directory, just make sure the filenames stay the same.

Not sure if the patch applies to the last release.

Rakshasa

Index: rtorrent/src/option_handler_rules.cc
===================================================================
--- rtorrent/src/option_handler_rules.cc        (revision 722)
+++ rtorrent/src/option_handler_rules.cc        (working copy)
@@ -56,6 +56,7 @@
 #include <torrent/tracker_list.h>
 
 #include "core/download.h"
+#include "core/download_list.h"
 #include "core/download_store.h"
 #include "core/manager.h"
 #include "core/scheduler.h"
@@ -70,6 +71,11 @@
 #include "option_handler_rules.h"
 #include "command_scheduler.h"
 
+namespace core {
+  extern void
+  path_expand(std::vector<std::string>* paths, const std::string& pattern);
+}
+
 void
 apply_hash_read_ahead(__UNUSED Control* m, int arg) {
   torrent::set_hash_read_ahead(arg << 20);
@@ -112,6 +118,22 @@
 }
 
 void
+apply_start_tied(Control* m, const std::string& arg) {
+  std::vector<std::string> paths;
+  paths.reserve(256);
+
+  core::path_expand(&paths, arg);
+
+  for (std::vector<std::string>::iterator itr = paths.begin(); itr != 
paths.end(); ++itr) {
+    core::DownloadList::iterator dItr = 
std::find_if(m->core()->download_list()->begin(), 
m->core()->download_list()->end(),
+                                                     rak::equal(*itr, 
rak::bind2nd(std::mem_fun(&core::Download::variable_string), "tied_to_file")));
+
+    if (dItr != m->core()->download_list()->end())
+      m->core()->download_list()->start(*dItr);
+  }
+}
+
+void
 apply_stop_untied(Control* m) {
   core::Manager::DListItr itr = m->core()->download_list()->begin();
 
@@ -121,7 +143,7 @@
     rak::file_stat fs;
 
     if (!fs.update(rak::path_expand((*itr)->variable_string("tied_to_file")))) 
{
-      (*itr)->variable()->set("tied_to_file", std::string());
+//       (*itr)->variable()->set("tied_to_file", std::string());
       m->core()->download_list()->stop(*itr);
     }
 
@@ -139,7 +161,7 @@
     rak::file_stat fs;
 
     if (!fs.update(rak::path_expand((*itr)->variable_string("tied_to_file")))) 
{
-      (*itr)->variable()->set("tied_to_file", std::string());
+//       (*itr)->variable()->set("tied_to_file", std::string());
       m->core()->download_list()->close(*itr);
     }
 
@@ -157,7 +179,7 @@
     rak::file_stat fs;
 
     if (!fs.update(rak::path_expand((*itr)->variable_string("tied_to_file")))) 
{
-      (*itr)->variable()->set("tied_to_file", std::string());
+//       (*itr)->variable()->set("tied_to_file", std::string());
       m->core()->download_list()->stop(*itr);
       itr = m->core()->download_list()->erase(itr);
 
@@ -471,9 +493,12 @@
   variables->insert("load_verbose",          new 
utils::VariableStringSlot(rak::value_fn(std::string()), 
rak::bind_ptr_fn(&apply_load_verbose, c)));
   variables->insert("load_start",            new 
utils::VariableStringSlot(rak::value_fn(std::string()), 
rak::bind_ptr_fn(&apply_load_start, c)));
   variables->insert("load_start_verbose",    new 
utils::VariableStringSlot(rak::value_fn(std::string()), 
rak::bind_ptr_fn(&apply_load_start_verbose, c)));
+
+  variables->insert("start_tied",            new 
utils::VariableStringSlot(rak::value_fn(std::string()), 
rak::bind_ptr_fn(&apply_start_tied, c)));
   variables->insert("stop_untied",           new 
utils::VariableVoidSlot(rak::bind_ptr_fn(&apply_stop_untied, c)));
   variables->insert("close_untied",          new 
utils::VariableVoidSlot(rak::bind_ptr_fn(&apply_close_untied, c)));
   variables->insert("remove_untied",         new 
utils::VariableVoidSlot(rak::bind_ptr_fn(&apply_remove_untied, c)));
+
   variables->insert("close_low_diskspace",   new 
utils::VariableValueSlot(rak::value_fn(int64_t()), 
rak::bind_ptr_fn(&apply_close_low_diskspace, c)));
   variables->insert("stop_on_ratio",         new 
utils::VariableStringSlot(rak::value_fn(std::string()), 
rak::bind_ptr_fn(&apply_stop_on_ratio, c)));
 
_______________________________________________
Libtorrent-devel mailing list
[email protected]
http://rakshasa.no/mailman/listinfo/libtorrent-devel

Reply via email to