mirror of
https://github.com/9001/copyparty.git
synced 2026-11-27 08:31:12 +00:00
up2k: iOS: reduce jitter;
* xhr.abort() to close/free tcp * onfoo=null fixes done-flicker
This commit is contained in:
1 parent
bfc3cff848
commit
971a62cc89
1 file changed
+14
-9
+14
-9
@@ -1012,6 +1012,11 @@ function up2k_init(subtle) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unxhr(xhr) {
|
||||||
|
xhr.onload = xhr.onerror = xhr.ontimeout = null;
|
||||||
|
apop(st.xhr, xhr);
|
||||||
|
}
|
||||||
|
|
||||||
var pvis = new U2pvis("bz", '#u2cards', uc, st),
|
var pvis = new U2pvis("bz", '#u2cards', uc, st),
|
||||||
donut = new Donut(uc, st);
|
donut = new Donut(uc, st);
|
||||||
|
|
||||||
@@ -1934,10 +1939,8 @@ function up2k_init(subtle) {
|
|||||||
if (!st.deaf)
|
if (!st.deaf)
|
||||||
console.log('xhr: bad apple');
|
console.log('xhr: bad apple');
|
||||||
|
|
||||||
xhr.onerror = xhr.ontimeout = null;
|
|
||||||
xhr.onload();
|
|
||||||
xhr.abort();
|
|
||||||
st.deaf = true;
|
st.deaf = true;
|
||||||
|
xhr.onload();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st.bytes.inflight && (st.bytes.inflight < 0 || !st.busy.upload.length)) {
|
if (st.bytes.inflight && (st.bytes.inflight < 0 || !st.busy.upload.length)) {
|
||||||
@@ -2498,12 +2501,12 @@ function up2k_init(subtle) {
|
|||||||
if (!toast.visible)
|
if (!toast.visible)
|
||||||
toast.warn(9.98, L.u_enethd + "\n\nfile: " + esc(t.name), t);
|
toast.warn(9.98, L.u_enethd + "\n\nfile: " + esc(t.name), t);
|
||||||
|
|
||||||
apop(st.xhr, xhr);
|
unxhr(xhr);
|
||||||
apop(st.busy.head, t);
|
apop(st.busy.head, t);
|
||||||
st.todo.head.unshift(t);
|
st.todo.head.unshift(t);
|
||||||
};
|
};
|
||||||
function orz(e) {
|
function orz(e) {
|
||||||
apop(st.xhr, xhr);
|
unxhr(xhr);
|
||||||
if (t.done)
|
if (t.done)
|
||||||
return console.log('done; skip head2', t.name, t);
|
return console.log('done; skip head2', t.name, t);
|
||||||
|
|
||||||
@@ -2571,7 +2574,7 @@ function up2k_init(subtle) {
|
|||||||
|
|
||||||
var xhr = new XHR();
|
var xhr = new XHR();
|
||||||
xhr.onerror = xhr.ontimeout = function () {
|
xhr.onerror = xhr.ontimeout = function () {
|
||||||
apop(st.xhr, xhr);
|
unxhr(xhr);
|
||||||
if (t.t_busied != me) // t.done ok
|
if (t.t_busied != me) // t.done ok
|
||||||
return console.log('zombie handshake onerror', t.name, t);
|
return console.log('zombie handshake onerror', t.name, t);
|
||||||
|
|
||||||
@@ -2584,7 +2587,7 @@ function up2k_init(subtle) {
|
|||||||
t.keepalive = keepalive;
|
t.keepalive = keepalive;
|
||||||
};
|
};
|
||||||
var orz = function (e) {
|
var orz = function (e) {
|
||||||
apop(st.xhr, xhr);
|
unxhr(xhr);
|
||||||
if (t.t_busied != me || t.done)
|
if (t.t_busied != me || t.done)
|
||||||
return console.log('zombie handshake onload', t.name, t);
|
return console.log('zombie handshake onload', t.name, t);
|
||||||
|
|
||||||
@@ -2963,7 +2966,7 @@ function up2k_init(subtle) {
|
|||||||
pcar == pcdr ? pcar : ('' + pcar + '~' + pcdr);
|
pcar == pcdr ? pcar : ('' + pcar + '~' + pcdr);
|
||||||
|
|
||||||
var orz = function (xhr) {
|
var orz = function (xhr) {
|
||||||
apop(st.xhr, xhr);
|
unxhr(xhr);
|
||||||
st.bytes.inflight -= xhr.bsent;
|
st.bytes.inflight -= xhr.bsent;
|
||||||
var txt = unpre((xhr.response && xhr.response.err) || xhr.responseText);
|
var txt = unpre((xhr.response && xhr.response.err) || xhr.responseText);
|
||||||
if (txt.indexOf('upload blocked by x') + 1) {
|
if (txt.indexOf('upload blocked by x') + 1) {
|
||||||
@@ -3014,7 +3017,9 @@ function up2k_init(subtle) {
|
|||||||
orz2(xhr);
|
orz2(xhr);
|
||||||
}
|
}
|
||||||
var orz2 = function (xhr) {
|
var orz2 = function (xhr) {
|
||||||
apop(st.xhr, xhr);
|
unxhr(xhr);
|
||||||
|
if (st.deaf)
|
||||||
|
xhr.abort();
|
||||||
apop(st.busy.upload, upt);
|
apop(st.busy.upload, upt);
|
||||||
for (var a = pcar; a <= pcdr; a++)
|
for (var a = pcar; a <= pcdr; a++)
|
||||||
apop(t.postlist, a);
|
apop(t.postlist, a);
|
||||||
|
|||||||
Reference in new issue
Block a user