Some fixes and updates
This commit is contained in:
@@ -169,7 +169,16 @@ async def main():
|
|||||||
bar = None
|
bar = None
|
||||||
f = None
|
f = None
|
||||||
i = 1
|
i = 1
|
||||||
|
number_of_chunks = None
|
||||||
while True:
|
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 = await ws.recv()
|
||||||
message = json.loads(message)
|
message = json.loads(message)
|
||||||
payload = message["payload"]
|
payload = message["payload"]
|
||||||
@@ -184,16 +193,11 @@ 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
|
||||||
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
|
||||||
i += 1
|
bar.suffix = "%(percent).1f%% complete - %(eta_td)s remaining " + str(i) + "/" + str(number_of_chunks) + " msg sent"
|
||||||
bar.next()
|
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())
|
asyncio.run(main())
|
||||||
Reference in New Issue
Block a user