Merge remote-tracking branch 'origin/master'

This commit is contained in:
artem30801@gmail.com
2019-03-29 17:12:59 +03:00
5 changed files with 18 additions and 7 deletions

View File

@@ -344,10 +344,10 @@ class Client:
return self._request_queue.pop(requested_value)
@requires_connect
def send_file(self, filepath, dest_filename):
def send_file(self, filepath, dest_filename, clever_restart = False):
print("Sending file ", dest_filename)
chunk_count = math.ceil(os.path.getsize(filepath) / Server.BUFFER_SIZE)
self.send(Client.form_message("writefile", {"filesize": chunk_count, "filename": dest_filename}))
self.send(Client.form_message("writefile", {"filesize": chunk_count, "filename": dest_filename, "clever_restart": clever_restart}))
with open(filepath, 'rb') as file:
chunk = file.read(Server.BUFFER_SIZE)
while chunk: