From 765294c263a0e90b19beba6a23e3b51aff9e612e Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 1 Jul 2021 20:22:12 +0200 Subject: [PATCH] ignore dupe-chunk warnings; handshake takes care of it --- copyparty/httpsrv.py | 3 ++- copyparty/web/up2k.js | 29 ++++++++++++++++------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/copyparty/httpsrv.py b/copyparty/httpsrv.py index 8bb5d0ed..d40373f7 100644 --- a/copyparty/httpsrv.py +++ b/copyparty/httpsrv.py @@ -141,11 +141,12 @@ class HttpSrv(object): "shut({}): {}".format(fno, ex), c="1;30", ) - if ex.errno not in [10038, 10054, 107, 57, 9]: + if ex.errno not in [10038, 10054, 107, 57, 49, 9]: # 10038 No longer considered a socket # 10054 Foribly closed by remote # 107 Transport endpoint not connected # 57 Socket is not connected + # 49 Can't assign requested address (wifi down) # 9 Bad file descriptor raise finally: diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index ef38c855..2621264c 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -1360,25 +1360,28 @@ function up2k_init(subtle) { cdr = t.size; function orz(xhr) { + var txt = ((xhr.response && xhr.response.err) || xhr.responseText) + ''; if (xhr.status == 200) { pvis.prog(t, npart, cdr - car); st.bytes.uploaded += cdr - car; t.bytes_uploaded += cdr - car; - st.busy.upload.splice(st.busy.upload.indexOf(upt), 1); - t.postlist.splice(t.postlist.indexOf(npart), 1); - if (t.postlist.length == 0) { - t.t4 = Date.now(); - pvis.seth(t.n, 1, 'verifying'); - st.todo.handshake.unshift(t); - } - tasker(); } - else + else if (txt.indexOf('already got that') !== -1) { + console.log("ignoring dupe-segment error"); + } + else { alert("server broke; cu-err {0} on file [{1}]:\n".format( - xhr.status, t.name) + ( - (xhr.response && xhr.response.err) || - (xhr.responseText && xhr.responseText) || - "no further information")); + xhr.status, t.name) + (txt || "no further information")); + return; + } + st.busy.upload.splice(st.busy.upload.indexOf(upt), 1); + t.postlist.splice(t.postlist.indexOf(npart), 1); + if (t.postlist.length == 0) { + t.t4 = Date.now(); + pvis.seth(t.n, 1, 'verifying'); + st.todo.handshake.unshift(t); + } + tasker(); } function do_send() { var xhr = new XMLHttpRequest();