mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
u2c: give up on files with bitflips
This commit is contained in:
parent
10defe6aef
commit
b9997d677d
19
bin/u2c.py
19
bin/u2c.py
|
@ -107,6 +107,7 @@ class File(object):
|
||||||
self.ucids = [] # type: list[str] # chunks which need to be uploaded
|
self.ucids = [] # type: list[str] # chunks which need to be uploaded
|
||||||
self.wark = None # type: str
|
self.wark = None # type: str
|
||||||
self.url = None # type: str
|
self.url = None # type: str
|
||||||
|
self.nhs = 0
|
||||||
|
|
||||||
# set by upload
|
# set by upload
|
||||||
self.up_b = 0 # type: int
|
self.up_b = 0 # type: int
|
||||||
|
@ -689,6 +690,7 @@ class Ctl(object):
|
||||||
|
|
||||||
def __init__(self, ar, stats=None):
|
def __init__(self, ar, stats=None):
|
||||||
self.ok = False
|
self.ok = False
|
||||||
|
self.errs = 0
|
||||||
self.ar = ar
|
self.ar = ar
|
||||||
self.stats = stats or self._scan()
|
self.stats = stats or self._scan()
|
||||||
if not self.stats:
|
if not self.stats:
|
||||||
|
@ -736,7 +738,7 @@ class Ctl(object):
|
||||||
|
|
||||||
self._fancy()
|
self._fancy()
|
||||||
|
|
||||||
self.ok = True
|
self.ok = not self.errs
|
||||||
|
|
||||||
def _safe(self):
|
def _safe(self):
|
||||||
"""minimal basic slow boring fallback codepath"""
|
"""minimal basic slow boring fallback codepath"""
|
||||||
|
@ -961,13 +963,19 @@ class Ctl(object):
|
||||||
self.q_upload.put(None)
|
self.q_upload.put(None)
|
||||||
break
|
break
|
||||||
|
|
||||||
with self.mutex:
|
|
||||||
self.handshaker_busy += 1
|
|
||||||
|
|
||||||
upath = file.abs.decode("utf-8", "replace")
|
upath = file.abs.decode("utf-8", "replace")
|
||||||
if not VT100:
|
if not VT100:
|
||||||
upath = upath.lstrip("\\?")
|
upath = upath.lstrip("\\?")
|
||||||
|
|
||||||
|
file.nhs += 1
|
||||||
|
if file.nhs > 32:
|
||||||
|
print("ERROR: giving up on file %s" % (upath))
|
||||||
|
self.errs += 1
|
||||||
|
continue
|
||||||
|
|
||||||
|
with self.mutex:
|
||||||
|
self.handshaker_busy += 1
|
||||||
|
|
||||||
hs, sprs = handshake(self.ar, file, search)
|
hs, sprs = handshake(self.ar, file, search)
|
||||||
if search:
|
if search:
|
||||||
if hs:
|
if hs:
|
||||||
|
@ -1187,6 +1195,9 @@ source file/folder selection uses rsync syntax, meaning that:
|
||||||
ar.z = True
|
ar.z = True
|
||||||
ctl = Ctl(ar, ctl.stats)
|
ctl = Ctl(ar, ctl.stats)
|
||||||
|
|
||||||
|
if ctl.errs:
|
||||||
|
print("WARNING: %d errors" % (ctl.errs))
|
||||||
|
|
||||||
sys.exit(0 if ctl.ok else 1)
|
sys.exit(0 if ctl.ok else 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue