mirror of
https://github.com/9001/copyparty.git
synced 2025-10-06 03:50:30 +02:00
add timeouts for mtp calls
This commit is contained in:
parent
6599c3eced
commit
c0e31851da
3 changed files with 33 additions and 11 deletions
|
@ -506,14 +506,37 @@ class Up2k(object):
|
|||
sz0 = os.path.getsize(db_path)
|
||||
|
||||
force = {}
|
||||
timeout = {}
|
||||
parsers = {}
|
||||
for parser in self.flags[ptop]["mtp"]:
|
||||
orig = parser
|
||||
tag, parser = parser.split("=", 1)
|
||||
if parser.lower().startswith("f,"):
|
||||
parser = parser[2:]
|
||||
force[tag] = True
|
||||
while True:
|
||||
try:
|
||||
bp = os.path.expanduser(parser)
|
||||
if os.path.exists(bp):
|
||||
parsers[tag] = [bp, timeout.get(tag, 30)]
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
||||
parsers[tag] = parser
|
||||
try:
|
||||
arg, parser = parser.split(",", 1)
|
||||
arg = arg.lower()
|
||||
|
||||
if arg == "f":
|
||||
force[tag] = True
|
||||
continue
|
||||
|
||||
if arg.startswith("t"):
|
||||
timeout[tag] = int(arg[1:])
|
||||
continue
|
||||
|
||||
raise Exception()
|
||||
|
||||
except:
|
||||
self.log("invalid argument: " + orig, 1)
|
||||
return
|
||||
|
||||
q = "select count(w) from mt where k = 't:mtp'"
|
||||
with self.mutex:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue