Fix last chunk not received

This commit is contained in:
SG
2023-05-12 13:40:26 +02:00
parent ef7ee52ad9
commit 260e29fbf6

View File

@@ -171,7 +171,7 @@ async def main():
i = 1 i = 1
number_of_chunks = None number_of_chunks = None
while True: while True:
if number_of_chunks is not None and i > number_of_chunks: if number_of_chunks is not None and i > number_of_chunks + 1:
bar.index = 100 bar.index = 100
bar.suffix = '%(percent).1f%% complete' bar.suffix = '%(percent).1f%% complete'
bar.update() bar.update()
@@ -193,7 +193,7 @@ async def main():
else: else:
f.write(msg["chunk"]) f.write(msg["chunk"])
msgtype = "proceed" msgtype = "proceed"
i += 1 # This increment has to happen before we try to send the confirmation message i += 1
await send_encrypted_msg(ws, k, (msgtype, peer_group_id, role, "", "", "", "", "")) # request the next chunk from sender await send_encrypted_msg(ws, k, (msgtype, peer_group_id, role, "", "", "", "", "")) # request the next chunk from sender
bar.suffix = "%(percent).1f%% complete - %(eta_td)s remaining " + str(i) + "/" + str(number_of_chunks) + " msg sent" bar.suffix = "%(percent).1f%% complete - %(eta_td)s remaining " + str(i) + "/" + str(number_of_chunks) + " msg sent"
bar.next() bar.next()