diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 0273f1dc..5b67c41a 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -293,7 +293,8 @@ class Up2k(object): job = job or reg[wark] if job["prel"] == cj["prel"] and job["name"] == cj["name"]: # ensure the files haven't been deleted manually - for fn in job["name"], job["tnam"]: + names = [job[x] for x in ["name", "tnam"] if x in job] + for fn in names: path = os.path.join(job["ptop"], job["prel"], fn) if not os.path.exists(path): job = None diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 9332ab63..e2d12ed9 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -349,16 +349,17 @@ function up2k_init(have_crypto) { // function handshakes_permitted() { - return multitask || ( - st.todo.upload.length == 0 && - st.busy.upload.length == 0); + var lim = multitask ? 1 : 0; + return lim >= + st.todo.upload.length + + st.busy.upload.length; } function hashing_permitted() { - return multitask || ( - handshakes_permitted() && - st.todo.handshake.length == 0 && - st.busy.handshake.length == 0); + var lim = multitask ? 1 : 0; + return handshakes_permitted() && lim >= + st.todo.handshake.length + + st.busy.handshake.length; } var tasker = (function () {