print "\t--upload-limit <up-speed-limit>"
print "\t-u <up-speed-limit>\tupload speed limitation in KB/s"
print "\t\t\t\t(default is no upload limit)"
+ print "\t--max-connections <num-connections>"
+ print "\t-n <num-connections>\tmaximum number of peer connections"
+ print "\t\t\t\t(default is no peer connection limit)"
print "\t--no-hash-check"
print "\t-c\t\t\tdisable downloaded file hash checking"
print "\t--peer-logging"
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:], "hvclu:d:o:p:", ["help", "version", "no-hash-check", "peer-logging", "upload-limit=", "download-limit=", "output-dir=", "port="])
+ opts, args = getopt.getopt(sys.argv[1:], "hvcln:u:d:o:p:", ["help", "version", "no-hash-check", "peer-logging", "max-connections=", "upload-limit=", "download-limit=", "output-dir=", "port="])
except getopt.GetoptError, err:
print str(err)
usage()
# init to default values
upload_limit = -1
download_limit = -1
+ max_conns = -1
output_dir = os.getcwd()
port = random.randint(10000, 65535)
enable_hash_check = True
download_limit = int(a)
elif o in ("-u", "--upload-limit"):
upload_limit = int(a)
+ elif o in ("-n", "--max-connections"):
+ max_conns = int(a)
elif o in ("-v", "--version"):
print_version()
sys.exit(0)
dscfg.set_max_speed(DOWNLOAD, download_limit)
if upload_limit > 0:
dscfg.set_max_speed(UPLOAD, upload_limit)
+ if max_conns > 0:
+ dscfg.set_max_conns(max_conns)
if torrentfile_or_url.startswith("http") or torrentfile_or_url.startswith(P2PURL_SCHEME):
tdef = TorrentDef.load_from_url(torrentfile_or_url)