Some fixes and updates

This commit is contained in:
SG
2023-05-11 21:20:23 +02:00
parent 4e583e39c3
commit ef7ee52ad9

View File

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