instrumentation/hrktorrent: add nohashcheck option
authorP2P-Next <p2p-next@cs.pub.ro>
Fri, 20 Aug 2010 13:18:41 +0000 (16:18 +0300)
committerP2P-Next <p2p-next@cs.pub.ro>
Fri, 20 Aug 2010 13:18:41 +0000 (16:18 +0300)
instrumentation/hrktorrent/core.cpp
instrumentation/hrktorrent/main.cpp
instrumentation/hrktorrent/settings.cpp

index b85cad7..e2ad610 100644 (file)
@@ -327,6 +327,10 @@ CCore::Run()
                parms.ti = info;\r
                parms.paused = false;\r
 \r
+               /* disable hash checking if configured */\r
+               if (Settings->GetI("hashcheck") == 0)\r
+                       parms.seed_mode = true;\r
+\r
                _torrent = _session->add_torrent(parms);\r
        } catch(std::exception& e) {\r
                std::cerr << "Could not add torrent (" << e.what() <<")" << std::endl;\r
index b1a25c5..bb506bd 100644 (file)
@@ -26,6 +26,7 @@ printusage(const char *argv0)
        std::cout << "\t-t, --nodht\t\t\tdisable dht (default: on)\n";
        std::cout << "\t-n, --noupnp\t\t\tdisable upnp (default: on)\n";
        std::cout << "\t-s, --noseed\t\t\tdisable seeding (default: enabled)\n";
+       std::cout << "\t-k, --nohashcheck\t\tdisable initial seeder hash checking (default: enabled)\n";
        std::cout << "\t-f, --forcereannounce <time>\treannounce every X minutes (default: 2)\n";
        std::cout << "\t-o, --outputdir <path>\t\tset the target directory (default: .)\n";
        std::cout << "\t-i, --ipfilter\t\t\tenable ip filtering (default: off)\n";
@@ -64,7 +65,7 @@ parseargs(int argc, char** argv)
        };
 
        while (1) {
-               opt = getopt_long(argc, argv, "hiltnsvVp:P:d:u:c:f:o:",
+               opt = getopt_long(argc, argv, "hiltnskvVp:P:d:u:c:f:o:",
                                long_options, &option_index);
                if (opt == -1)
                        break;
@@ -89,6 +90,9 @@ parseargs(int argc, char** argv)
                case 's':
                        Settings->Set("seed", 0);
                        break;
+               case 'k':
+                       Settings->Set("hashcheck", 0);
+                       break;
                case 'v':
                        Settings->Set("verbose", 1);
                        break;
index 8166139..b2639e7 100644 (file)
@@ -17,6 +17,7 @@ CSettings::CSettings()
        Set("dht", 1);\r
        Set("upnp", 1);\r
        Set("seed", 1);\r
+       Set("hashcheck", 1);\r
        Set("forcereannounce", 2);\r
        Set("ipfilter", 1);\r
        Set("limitlocal", 0);\r