diff --git a/README.md b/README.md index 388a6477..0d7d2ccf 100644 --- a/README.md +++ b/README.md @@ -622,6 +622,8 @@ in the `scripts` folder: roughly sorted by priority +* keepalive handshake after 5h + * skip pushing postlist if todo.upload has entries * readme.md as epilogue * reduce up2k roundtrips * start from a chunk index and just go diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index b50599c6..c54d75fd 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -607,13 +607,14 @@ class HttpCli(object): os.makedirs(fsenc(dst)) except OSError as ex: self.log("makedirs failed [{}]".format(dst)) - if ex.errno == 13: - raise Pebkac(500, "the server OS denied write-access") + if not os.path.isdir(fsenc(dst)): + if ex.errno == 13: + raise Pebkac(500, "the server OS denied write-access") - if ex.errno == 17: - raise Pebkac(400, "some file got your folder name") + if ex.errno == 17: + raise Pebkac(400, "some file got your folder name") - raise Pebkac(500, min_ex()) + raise Pebkac(500, min_ex()) except: raise Pebkac(500, min_ex()) diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index f980011b..0362adfd 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -612,7 +612,7 @@ function up2k_init(subtle) { } else files = e.target.files; - if (!files || files.length == 0) + if (!files || !files.length) return alert('no files selected??'); more_one_file(); @@ -837,13 +837,20 @@ function up2k_init(subtle) { // function handshakes_permitted() { - var lim = multitask ? 1 : 0; + // verification + if (st.todo.handshake.length && + st.todo.handshake[0].t4) + return true; - if (lim < + if ((multitask ? 2 : 0) < st.todo.upload.length + st.busy.upload.length) return false; + if (parallel_uploads < + st.busy.handshake.length) + return false; + var cd = st.todo.handshake.length ? st.todo.handshake[0].cooldown : 0; if (cd && cd - Date.now() > 0) return false; @@ -917,22 +924,8 @@ function up2k_init(subtle) { st.todo.handshake.unshift(t); } - if (st.todo.handshake.length > 0 && - st.busy.handshake.length == 0 && ( - st.todo.handshake[0].t4 || ( - handshakes_permitted() && - st.busy.upload.length < parallel_uploads - ) - ) - ) { - exec_handshake(); - mou_ikkai = true; - } - if (handshakes_permitted() && - st.todo.handshake.length > 0 && - st.busy.handshake.length == 0 && - st.busy.upload.length < parallel_uploads) { + st.todo.handshake.length) { exec_handshake(); mou_ikkai = true; } @@ -945,7 +938,7 @@ function up2k_init(subtle) { if (hashing_permitted() && st.todo.hash.length > 0 && - st.busy.hash.length == 0) { + !st.busy.hash.length) { exec_hash(); mou_ikkai = true; } @@ -1376,7 +1369,7 @@ function up2k_init(subtle) { } st.busy.upload.splice(st.busy.upload.indexOf(upt), 1); t.postlist.splice(t.postlist.indexOf(npart), 1); - if (t.postlist.length == 0) { + if (!t.postlist.length) { t.t4 = Date.now(); pvis.seth(t.n, 1, 'verifying'); st.todo.handshake.unshift(t);