mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
ok ok
This commit is contained in:
parent
e4654ee7f1
commit
e5c4f49901
|
@ -747,9 +747,21 @@ function up2k_init(have_crypto) {
|
|||
|
||||
var tasker = (function () {
|
||||
var tto = null,
|
||||
running = false,
|
||||
was_busy = false;
|
||||
|
||||
function defer() {
|
||||
running = false;
|
||||
clearTimeout(tto);
|
||||
tto = setTimeout(taskerd, 100);
|
||||
}
|
||||
|
||||
function taskerd() {
|
||||
if (running)
|
||||
return;
|
||||
|
||||
clearTimeout(tto);
|
||||
running = true;
|
||||
while (true) {
|
||||
var is_busy = 0 !=
|
||||
st.todo.hash.length +
|
||||
|
@ -770,11 +782,8 @@ function up2k_init(have_crypto) {
|
|||
if (is_busy) {
|
||||
var now = new Date().getTime();
|
||||
flag.take(now);
|
||||
if (!flag.ours) {
|
||||
clearTimeout(tto);
|
||||
tto = setTimeout(taskerd, 100);
|
||||
return;
|
||||
}
|
||||
if (!flag.ours)
|
||||
return defer();
|
||||
}
|
||||
else if (flag.ours) {
|
||||
flag.give();
|
||||
|
@ -816,11 +825,8 @@ function up2k_init(have_crypto) {
|
|||
mou_ikkai = true;
|
||||
}
|
||||
|
||||
if (!mou_ikkai) {
|
||||
clearTimeout(tto);
|
||||
tto = setTimeout(taskerd, 100);
|
||||
return;
|
||||
}
|
||||
if (!mou_ikkai)
|
||||
return defer();
|
||||
}
|
||||
}
|
||||
taskerd();
|
||||
|
|
Loading…
Reference in a new issue