From 23b25c6e145cbaf04e263fbf3d065c93b7d106a6 Mon Sep 17 00:00:00 2001 From: P2P-Next Date: Mon, 20 Sep 2010 14:38:11 +0300 Subject: [PATCH] next-share: add no-hash-checking option --- instrumentation/next-share/BaseLib/Tools/cmdlinedl.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/instrumentation/next-share/BaseLib/Tools/cmdlinedl.py b/instrumentation/next-share/BaseLib/Tools/cmdlinedl.py index 7f76229..b6d4405 100644 --- a/instrumentation/next-share/BaseLib/Tools/cmdlinedl.py +++ b/instrumentation/next-share/BaseLib/Tools/cmdlinedl.py @@ -39,6 +39,8 @@ def usage(): print "\t--upload-limit " print "\t-u \tupload speed limitation in KB/s" print "\t\t\t\t(default is no upload limit)" + print "\t--no-hash-check" + print "\t-c\t\t\tdisable downloaded file hash checking" print "\t--version" print "\t-v\t\t\tprint version and exit" print "\t--help" @@ -67,7 +69,7 @@ def main(): try: # opts = a list of (option, value) pairs # args = the list of program arguments left after the option list was stripped - opts, args = getopt.getopt(sys.argv[1:], "hvu:d:o:p:", ["help", "version", "upload-limit=", "download-limit=", "output-dir=", "port="]) + opts, args = getopt.getopt(sys.argv[1:], "hvcu:d:o:p:", ["help", "version", "no-hash-check", "upload-limit=", "download-limit=", "output-dir=", "port="]) except getopt.GetoptError, err: print str(err) usage() @@ -78,6 +80,7 @@ def main(): download_limit = -1 output_dir = os.getcwd() port = random.randint(10000, 65535) + enable_hash_check = True for o, a in opts: if o in ("-h", "--help"): @@ -94,6 +97,8 @@ def main(): elif o in ("-v", "--version"): print_version() sys.exit(0) + elif o in ("-c", "--no-hash-check"): + enable_hash_check = False else: assert False, "unhandled option" @@ -123,6 +128,7 @@ def main(): # setup and start download dscfg = DownloadStartupConfig() + dscfg.set_check_hashes(enable_hash_check) dscfg.set_dest_dir(output_dir); if download_limit > 0: dscfg.set_max_speed(DOWNLOAD, download_limit) -- 2.20.1