This commit is contained in:
ziirish 2020-05-23 23:16:31 +02:00
parent b0412fec66
commit 48aed7aa2a
No known key found for this signature in database
GPG key ID: 72DB229A64B54E46
3 changed files with 9 additions and 9 deletions

View file

@ -244,16 +244,16 @@ class TaskGetFile(Resource):
lengthbuf = socket.recv(8)
length, = struct.unpack('!Q', lengthbuf)
def stream(sock, l):
def stream(sock, size):
"""The restoration took place on another server so we need
to stream the file that is not present on the current
machine.
"""
bsize = 1024
received = 0
if l < bsize:
bsize = l
while received < l:
if size < bsize:
bsize = size
while received < size:
buf = b''
r, _, _ = select.select([sock], [], [], 5)
if not r:
@ -262,7 +262,7 @@ class TaskGetFile(Resource):
if not buf:
continue
received += len(buf)
self.logger.debug('{}/{}'.format(received, l))
self.logger.debug('{}/{}'.format(received, size))
yield buf
sock.sendall(struct.pack('!Q', 2))
sock.sendall(b'RE')

View file

@ -1148,7 +1148,7 @@ def diag(client, host, tips):
err(
'Some errors have been found in your configuration. '
'Please make sure you ran this command with the right flags! '
'(see --help for details).'.format(sys.argv[0], sys.argv[1])
'(see --help for details).'
)
else:
info(