mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
parallelize handshakes
This commit is contained in:
parent
c95941e14f
commit
a5120d4f6f
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue